- #1
Avichal
- 295
- 0
In an operating system, system call is an interface to provide services to the user. Services include I/O operations, process management etc.
Further, the C library provides me API above these system calls to make life easier. So printf, scanf internally use these system calls in the end.
Q.) Am I right till now?
So when I write a program say something like this:
I understand that printf is an API that helps me display stuff on the screen. Internally it uses some API.
But the lines "int x = 1" and "int y = 2", these also help me allocate memory and then assign some value to that memory. So in a way it is providing me service to access memory.
Q.) So is it also an API or a system call?
Further, the C library provides me API above these system calls to make life easier. So printf, scanf internally use these system calls in the end.
Q.) Am I right till now?
So when I write a program say something like this:
Code:
#include <stdio.h>
int main()
{
int x = 1;
int y = 2;
printf("%d\n", x+y);
return 0;
}
I understand that printf is an API that helps me display stuff on the screen. Internally it uses some API.
But the lines "int x = 1" and "int y = 2", these also help me allocate memory and then assign some value to that memory. So in a way it is providing me service to access memory.
Q.) So is it also an API or a system call?