






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























All this make C a far better choice for system programming.
/* Hello World program */ #include <stdio.h>
void main(void){ printf("Hello World.\n"); }
$ ./hello Hello World.
/* declare and allocate space for array A */ int A[10]; for (int i=0; i<10; i++) A[i]=0;
char[] name="CS415"; name[4]=’5’;
- Functions to operate on strings in string.h. ∗ strcpy, strcmp, strcat, strstr, strchr.
printf("The number of students in %s is %d.\n", "CS415", 80);
int i; int* ptr_int; /* ptr_int points to some random location / ptr_int = &i; / ptr_int points to integer i / (ptr_int) = 3; /* variable pointed by ptr_int takes value 3 */
struct list_elem{ int data; struct list_elem* next; };
struct list_elem le={ 10, NULL }; struct list_elem* ptr_le = ≤ printf("The data is %d\n", ptr_le->data);
typedef int Bool; Bool bool_var; typedef int* Intptr; Intptr p; /* p is a pointer to int / typedef struct list_el list_el; / list_el is alias for struct list_el / struct list_el { int data; list_el next; /* this is legal */ };
Local variables:
Heap variables: