Search

Sponsored Links

Meta

Categories

Archives

Recent Posts

RSS Feeds

04
Nov

C Obscurity Tests (with reasons behind them)

Related Blog Items

Why char *p=? ponnada? ? ; *p=M dont work? ?

Char *p= “ponnada” ; char *r= “rajulu” ;

*p=M? ; *r=M? ;

p doesnt work where as r works because eventhough p is not a constant variable

the string ? ponnada? stored in .rodata (readonl? y) section, so while modifing

u get an error. R will be stored in stack, so no problems.

But p works on turbo C on windows mechines, so it is not safe to use that way if we need portability, depending

on compiler we may get error.

?

Obscurity Test? :

? ? ? if (? !strcmp(? ponnada? , ? ponnada\0? )) printf(? ..\n? )? ; it prints the dots, coz there is no diff between ? ponnada? and ? ponnada\0? .

? ? ? calloc(2) works? ?? ans? : works but behaviour compiler dependent. Reason? : in C u can pass any number of args, any type of args in a function . if u dont declare a proto u wont even get a warning. Thats why calloc(2) works, calloc takes 2 params (number of items, sizeof item), so here 2 is passed as number of items, size of item will be some junk value, an it tries to allocate

? ? ? int j*=10 works? ?? compilation error

[tags]c obscurity tests[/tags]

Popularity: 5%

You need to log on to convert this article into PDF


Related Blog Items

No Comments

No comments yet.

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image