











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Basic Computer Programming in C
Typology: Study notes
1 / 19
This page cannot be seen from the preview
Don't miss anything!












=>Format specifier – represented by
=> Addressof is represented by - &. => Operators :-
1.&& - AND operator 2.|| - OR operator X Y AND OR XOR 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 => Conditional operators ? - then : - else => If else Statement:- Syntax = if(Condition){ } Else{ } NOTE- LINE prints the line no. ( printf(“%d”, LINE); ) NOTE -
=>For Loop:- Syntax:- for (initialization; condition ; increment or decrement){ statement; statement; }
Output-
Function:-
Arrays **Note- int n = 6;
is invalid location can be written as- &a[1] or (a + 1) the data can be accessed by- a[1] or *(a + 1)
Pointers
Scanf Syntax – scanf(“Format specifer”, variable);
Calloc function It creates dynamic memory in the heap.
gets(takes the variable of string)- It takes user input from keyboard of a line until the cursor moves to to next line. puts(takes thevariable of string)- It gives output of the input line given. strlen()-It return integer value of length of string given in parameter. strcpy(x,y)-It takes two parameters such that it copies the string from y to x. strcat(x, y)- It takes two Strings parameter and concatenates them like here it will return x + y. strcmp(x, y)- It takes two strings as parameter and compares them and return -1, 0 , 1 if x > y, x == y, x > y respectively. 2D array used to store multiple Strings
Defining Macros