Posted on February 26, 2007 by awmanoj
What does following code mean ?
scanf(“%[^a]“,dummy);
It means that continue accepting a string before you encounter the character ‘a’. This can be used to input a string containing white space characters by putting ‘\n’ as the character where to stop.
Filed under: Uncategorized | Leave a Comment »
Posted on February 23, 2007 by awmanoj
A data item is aligned in memory when its address is a multiple of its size in bytes. For instance, the address of an aligned short integer must be a multiple of two while the address of an aligned integer must be a multiple of four.
Why is it important to know about alignment ?
Assembly language [...]
Filed under: linux kernel, technical | Leave a Comment »
Posted on February 14, 2007 by awmanoj
What is the difference between returning from main with some exit code and calling exit giving the exit code as parameter ?
Basically the difference between following programs !
//ret.c
int main()
{
return 43;
}
//exit.c
int main()
{
exit(43);
}
well, there are three ways for the processes to exit: -
1. Voluntary exit (implicit)
2. Voluntary exit (explicit)
3. Involunatary exit
Voluntary exit can be implicit [...]
Filed under: C++, Programming, linux | 1 Comment »
Posted on February 13, 2007 by awmanoj
A nice question, I came through while being in an interview. Well, so how do you make sure that the object can be instantiated only on heap and not on stack ? so, if you are of the kind who don’t think without being given the use and purpose .. well the purpose is that [...]
Filed under: C++, Programming | Leave a Comment »
Posted on February 5, 2007 by awmanoj
quick question: what’s the difference between fork() and vfork() system calls ?
quick answer: vfork() system call creates a process that shares the memory address space of its parent.
details:
fork() is implemented by linux as a clone() system call whose flags parameter specifies both a SIGCHLD signal and all the clone flags cleared and whose child_stack parameter [...]
Filed under: linux, linux kernel, technical | Leave a Comment »
Posted on February 5, 2007 by awmanoj
a quick question in interviews: what is the difference between jmp and far jmp ?
a quick answer: far jmp modified both CS and EIP while jmp modifies only EIP.
Filed under: linux, linux kernel, technical | Leave a Comment »