



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
A collection of c programming exercises designed to reinforce fundamental concepts. Each exercise includes code snippets, explanations, and expected outputs, providing a comprehensive learning experience. The exercises cover topics such as pointers, data types, operators, control flow, and functions, enabling users to solidify their understanding of c programming principles.
Typology: Study notes
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Output: 130
printf(“Hello”); } Ccc() { printf(“Bye”); } void main() { int (*ptr[3])(); ptr[0] = Aaa; ptr[1] = Bbb; ptr[2] = Ccc; ptr2; } Answer : a. Hello b. Hi c. Bye d.compilation error
int a; struct temp no_roll; double c; }obj; Answers: a. Underscore cannot be used in variable declaration b. it will be compiled successfully c. obj must be a pointer to struct d. error: struct variables cannot be included in its own structure
int takefirst(int a,int b,int c) { return (++a,b+2,c); } void main( ) { static int m,n; m = takefirst(n,m,n); printf(“%d”,m); }
Answer : a. 2 b.1 c.0 d. syntax error in return statement
void main() { printf("Today \r is a7\b great \tday");} Answers :
void main( ) { int i=107,x=5; printf((x>7)?”%d”:”%c”,i); } Answers: a. compilation error b. k c. z d. 107
int show(int v) { if(v==1||v==0) return 1; if(v % 2==0) return show(v/2) +2;