Answered Questions

  • ">

    What happens when the following code is executed? #include <stdio.h> main(){ char *s; if (s == "10") { printf("string matches"); } }

    In the above code the operator == is used to compare the value of string. But this is not allowed. This is because in C program string is represented as array of characters. So the operate like comparison, assignment and so on cannot be used to manipulate array as whole. So the above code does not work. In order to achieve the string comparison instead of using == C programmers must use function named...

    Raman Katwal

    • Jun 29th, 2007

    I agree with you ... It will not generate any kind of output due to the address problem in case of 32 bit machine.

  • What happens when a variable is not initialized in main function?

    When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf( “%d”,x); z= sample() } sample() { printf(“Testing program”); } Output is x=80 Testing program The above program prints a garbage value and the output testing program .This is because the variable...

    kvsmp2

    • Oct 13th, 2006

    As the above illustrates that if we are not intializint the varaible we get garbarge value.This is because when you define a variable the compiler calls the os then os allocates the required memory (w...

  • How is C++ a higher level of C?

    C++ is an improved and higher level of C with more features and abilities built in it. Apart from the regular features of C the other features which C++ possess which makes it a higher level of C are classes, objects, constructors and destructors, virtual functions, concept of polymorphism, abstract classes, able to provide access levels like public, private and protected for members, friend functions,...

    kvsmp2

    • Oct 13th, 2006

    c++ is higher than C in ,many ways.but to keep it simple : with C it diffcult to represnt the real world whereas with c++ we can represent real eworld things.Examples: in c++ we have objests that repe...

    hari

    • Sep 27th, 2006

    Wt mean by QA  how it defines and purposes and features