KEMBAR78
C Programming Quirks | PDF | Mathematical Analysis | Functions And Mappings
100% found this document useful (1 vote)
385 views19 pages

C Programming Quirks

The document contains code snippets and output related to C programming concepts like operators, data types, control flow, functions etc. Some key things demonstrated include: 1. Pointer dereferencing and address manipulation. 2. Pre and post increment operators. 3. Bitwise operators. 4. String concatenation and printing. 5. Structures and bit fields. 6. Control flow using loops and conditional statements.

Uploaded by

Deepan Kishore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
385 views19 pages

C Programming Quirks

The document contains code snippets and output related to C programming concepts like operators, data types, control flow, functions etc. Some key things demonstrated include: 1. Pointer dereferencing and address manipulation. 2. Pre and post increment operators. 3. Bitwise operators. 4. String concatenation and printing. 5. Structures and bit fields. 6. Control flow using loops and conditional statements.

Uploaded by

Deepan Kishore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

#include <stdio.

h>

int main()
{
int a = 0,b = 1,c = 3;
*((a)?&b:&a) = a?b:c;
printf("%d %d %d",a, b, c);
return 0;
}

3 1 3

 
#include <stdio.h>

int main()
{
int i=10;
printf("%d %d",i++ ,++i);
return 0;
}

11 12

 
#include <stdio.h>

int main()
{
int i = 2;
int j = i + (1, 2, 3, 4, 5);
printf("%d",j);
return 0;
}

 
#include <stdio.h>

#include <stdlib.h>

int main()
{
int *arr;
arr= (int) malloc(10 * sizeof(int));
printf("size = %d", sizeof(arr));
return 0;
}

size = 4 
#include <stdio.h>

int main()
{
int x = 10, y = 20, z = 30, a = 40;
int b = 50;
printf("%d %d %d %d %d", x, b);
return 0;
}

10 50 4199880 4007024 4006968

 
#include <stdio.h>

int main()
{
char a = 64;
a = a - 92 -(-5);
printf("%d", a);
return 0;
}

-23

 
#include <stdio.h>

int main()
{
int a, b, c;
a = 10;
b = 1;
c = a--;
printf("%d", c);
return 0;
}

10
#include <stdio.h>

int main()
{
int x;
for(;;)
{
x++;
if(x == 10)
break;
}
printf("%d", x);
return 0;
}

10
#include <stdio.h>

int main()
{
int i;
printf("%d,%d", 1, i);
return 0;
}
 

1,4203553

 
#include <stdio.h>

int main()
{
float x = 20;
x = -x / ++x;
printf("%f", x);
return 0;
}

-0.952381
#include <stdio.h>

int main()
{
char c;
int x, y, z;
x = 5;
y = 6;
printf("%d,", x ^ y);
printf("%d,", z ^ z);
printf("%d,", c ^ c);
printf("%d,", c ^ c);
return 0;
}

3,0,0,0,
#include <stdio.h>

int main()
{
printf("Good\nWo\rrk");
printf("Good %c work", 90);
return 0;
}

Good
Wo
rkGood Z work
#include <stdio.h>

int main()
{
int *p, **q, i = 10;
p = &i;
q = &p;
free(p);
printf("%d,%d", i, p);
return 0;
}

10,2293428

 
#include <stdio.h>

int main()
{
char abc[][2]={'a','b','c','d','e','f','g','h'};
printf("%s", abc[1]);
return 0;
}

cdefgh
#include <stdio.h>

int main()
{
char abc[][2]={'a','b','c','d','e','f','g','h'};
printf("%s", abc[2]);
return 0;
}

efgh

 
#include <stdio.h>

int main()
{
printf("%s%s%s",("Zoho" "corp"),("Campus" "corp"),
("Zoho" "Corporation"));
return 0;
}

ZohocorpCampuscorpZohoCorporation

 
#include <stdio.h>

int main()
{
int x= 3, y = 4, z = 4;
printf("ans = %d\n",(z >= y >= x?100:200));
return 0;
}

ans = 200
#include <stdio.h>

int main()
{
int i=0;
do
{
printf("%d",i);
} while(i++);
return 0;
}

0
#include <stdio.h>

int main()
{
struct num
{
int n1:2;
int n2:3;
int n3:4;
};

struct num n;
n.n1 = 3;
n.n2 = 4;
n.n3 = 5;
printf("%d %d %d", n.n1, n.n2, n.n3);
return 0;
}

-1 -4 5

You might also like