C Interview Questions

Showing Questions 701 - 720 of 758 Questions
First | Prev | Next | Last Page
Sort by: 
 | 
Jump to Page:
  •  

    How to find angle between hands of clock between old time and new time?

    input1: 02:45:56 (string)
    input2: 03:06:17 (string)

    output:
    1) angle between the old position of hour hand and new position of hour hand
    2) angle between the old position of minute hand and new position of minute hand
    3) angle between the old position of second hand and new position of second hand

    Sathya Hadadi

    • Apr 28th, 2015

    Answer in code part"c #include #include #include #include #define MIN_PER_HOUR 60.0F #define SEC_PER_MIN 60.0F #define SEC_PER_HOUR (MIN_PER_HOUR*SEC_PER_...

  •  

    Big endian or Little endian

    How will you find whether your system is following Big endian or Little endian representations. Write C code. In Little endian, the lowest byte is stored in lowest address.

    saikamal

    • Jan 31st, 2016

    The best way to check whether CPU follows little endian or big endian : main() { int var=1; char*p=&var; if(*p==1) printf("Little endian "); else printf("Big endian "); } NOTE: size of ...

  •  

    Find Longest Common Substring

    Write a Logic/Pseudo Code to find longest common substring from two given strings. i.e. Out of two strings, “I like New York City the most.†And “Who else like New York City as I do?â€, “like New York City†is the longest common substring.

    perumal

    • May 24th, 2017

    Code is attached

    Code
    1. #include<stdio.h>
    2. #include<string.h>
    3. "I like New York City the most""Who else like New York City as I do"//              printf("  %d",maxmatch);//printf("
    4.  
    5.  pre%d max%d",prevmatch,maxmatch);
    6. if (prevmatch > maxmatch)
    7. {
    8.  for (i=prevstart;i<prevmatch+prevstart;i++)
    9.  {
    10.    printf("%c",str2[i]);
    11.  }
    12. }
    13. else if(maxmatch)
    14. {
    15.  for (i=matchstart;i<maxmatch;i++)
    16.  {
    17.    printf("%c",str2[i]);
    18.  }
    19. }
    20.  
    21. }
    22. ~

  •  

    Difference between b++ and b=b+1

    What is the difference between b++ and b=b+1?
    Which one is more used and why?

    jbode

    • Jul 11th, 2017

    The main differences between `b++` and `b = b + 1` is that in the first case, `b` is only evaluated once, and the result of the first expression is the value of `b` *before* the increment. `b++` ...

  •  

    Size of structure

    struct {
    int a : 8;
    int b : 10;
    int c : 12;
    int d : 4;
    int e : 3;
    int : 0;
    int f : 1;
    char g;
    } A;

    what is the size of structure. size of bitfields with out character allocation is 48 bytes. so it is taking 4+4 =8 bytes. what about memory for character. Why memory for char is not allocated seperately. I am...

    shailesh

    • Nov 22nd, 2018

    Data alignment is different than checking the size, so please dont mingle these two concepts,Now 8+10+12+4+3=37 == 8Bytes gone(if int is of 4Bytes)its taking next boundary for int f and char g,caz in...

  •  

    What is the difference between goto and longjmp() and setjmp()?

    A goto statement implements a local jump of program execution, and the longjmp() and setjmp() functions implement a nonlocal, or far, jump of program execution. Generally, a jump in execution of any kind should be avoided because it is not considered good programming practice to use such statements as goto and longjmp in your program. A goto statement simply bypasses code in your program and jumps...

    nitin bhokare

    • Oct 3rd, 2005

    using the normal goto statement we can move only within the function. it is not possible to go from one function to another function.using setjmp and longjmp you can move from one function to another ...

  •  

    Is it acceptable to declare/define a variable in a C header?

    A global variable that must be accessed from more than one file can and should be declared in a header file. In addition, such a variable must be defined in one source file. Variables should not be defined in header files, because the header file can be included in multiple source files, which would cause multiple definitions of the variable. The ANSI C standard will allow multiple external definitions,...

  •  

    What is the easiest searching method to use?

    Just as qsort() was the easiest sorting method, because it is part of the standard library, bsearch() is the easiest searching method to use. If the given array is in the sorted order bsearch() is the best method. Following is the prototype for bsearch(): void *bsearch(const void *key, const void *buf, size_t num, size_t size, int (*comp)(const void *, const void*));  Another simple searching...

  •  

    How can I search for data in a linked list?

    Unfortunately, the only way to search a linked list is with a linear search, because the only way a linked list’s members can be accessed is sequentially. Sometimes it is quicker to take the data from a linked list and store it in a different data structure so that searches can be more efficient.  

    rakesh

    • Oct 7th, 2006

    hai here am writing a simple ex for searchina linked list for specific valuestruct link{int data;struct link *node;}if the above struct is a node such that in a node u can store a data and pointer to ...

  •  

    What is Preprocessor?

    The preprocessor is used to modify your program according to the preprocessor directives in your source code. Preprocessor directives (such as #define) give the preprocessor specific instructions on how to modify your source code. The preprocessor reads in all of your include files and the source code you are compiling and creates a preprocessed version of your source code. This preprocessed version...

    supriya ahire

    • Mar 18th, 2006

    Hi,   preprocessor is a program which processes our source program before it goes to the compiler for compilation.

  •  

    What is #line used for?

    The #line preprocessor directive is used to reset the values of the _ _LINE_ _ and _ _FILE_ _ symbols, respectively. This directive is commonly used in fourth-generation languages that generate C language source files.

    A.ASHIQ MOHAMMED

    • Jul 8th, 2005

    Dear Sir, I am a Computer Science Lecturer. Really 'C' Ques & Ans are very useful for us. Please could you send me a soft copy to my Email.I will recommand this site to my studentd. Thanking You ASHIQ MOHAMMED aashiq_md@yahoo.co.in

  •  

    What is a null pointer?

    There are times when it’s necessary to have a pointer that doesn’t point to anything. The macro NULL, defined in <stddef.h>, has a value that’s guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL.  The null pointer is used in three ways: 1) To stop indirection in...

    supriya ahire

    • Mar 22nd, 2006

    hi,   Null pointer:   When referring to computer memory, a null pointer is a command used to direct a software program or operating system to an empty location in the computer memo...

Showing Questions 701 - 720 of 758 Questions
First | Prev | Next | Last Page
Sort by: 
 | 
Jump to Page: