Friday, December 24, 2010

C Post

This is my compilation of some C questions I have googled and gathered from the web.



(1) unsigned int x = -1; x >>= 2 .What will the value of X?

Value of X will be --> UINT_MAX ( Maximum int Value in the System)
UINT_MAX is defined in the <limits.h>


Therefore :
 x >>= 2 = Integral part of (UINT_MAX/4 (a>>b = a /2^b))

UINT_MAX is also equal to the 0xFFFFFFFF ( that is size of Intezer on a system*2 times F ) 
For example if the size of Intezer is 4 bytes(32 bit) the value of Max int = (2^32) -1
This solution can also be made to find out the size of an intezer on a machine.But for that you have to store the bigger values like 4294967295((2^32) -1)
Alternate way to find out the Size of Intezer is  to find the difference between the &(x) and &(x++) .


(2) Accessing a function Pointer via Structure - Hidden OOPS ?


#include<stdio.h>
void (*funcPtr)();
typedef struct test
{
int x;
char y;
void (*ptr)();

}tstruct;
void show()
{
printf("Demoi \n");
}
void main()
{
tstruct z;
z.x = 100;
z.y = 900;
z.ptr = show;
z.ptr();


}

This programm shows some hidden feature of how OOPs can be implemented using the C.If we assign x as n boolean flag for accessing the function pointed to by the ptr variable , I am sure we can do some OOP stuff here with this code.

(3) What is the structure of the programme in the memory?



More ...to be contniued..!





Friday, December 10, 2010

And finalyy got Nokia N900 !!

..well its been 2 yrs at nokia..and Nokia has given me for all those valuable effortless, bugless contribution I have made to the society via Nokia..reallly!!! Nossss its just a policy..we get a new phone for ervy two years completeion and a new laptop for evry three yr completeion..i hope I am not befriending wikileaks here...HR are you listening...!! Kidding....this is the first resistive Touch , MMS less, 3.5 g, 5 mxpl, 28 gb memory, --LINUXXXXXXX based mobile phone..yeah its the maemo from Nokiee..in the smart phone segment..(ya you got me right I am boasting implicitly for my not-so-usefull-googlish-skill )..pretty good descent digg-me-more device ..first and the last of Nokia's Linux tryst in the smart phone cateogary ..in the class of.embedded device..last because now maemo will come with meego..(truly speaking not an embedded device as I can open an Xterminal and use it for building any other application using some not-so-junk linux shell..and if I can use it for that how it could be the embedded device..need to revise my definition of ED..).It didnt get much good appreciation from the user community...though the developer/testers/debuggers community boasted it most..the commercialization of an open source is the crux of the blog...maemo, meego(maemo+goblin) and of course our anti-nokiee community(android folowers) share the 90% of the the Mobile OS code)...all seems to be the same... who will win..is the question ..whose answer lies totalyy on the consumer..that means the UI...that means teh -the application --that means(TM) -framework- Qt or XYZt(possible for anti-nokia)-TM- commercialization of APplication framework consultant-TM-..list is short...!!

N9.....





so where do I go from here...!!