1 / 12

INTRODUCTION

INTRODUCTION. A.MUTHUKUMARAVEL, M.Com.M.C.A.M.Phil (Ph.D). C. What are the differences between structures and unions?

adli
Download Presentation

INTRODUCTION

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INTRODUCTION A.MUTHUKUMARAVEL, M.Com.M.C.A.M.Phil (Ph.D)

  2. C • What are the differences between structures and unions? * Union allocates the memory equal to the maximum memory required by the member of the union but structure allocates the memory equal to sum of the memory allocated to its each individual members. * In Union, one block is used by all the member of union but in case of structure, each member have Their own memory space.

  3. C • What are the advantages of using unions? unions conserves memory space..The amount of space allocated for union is based on the member which requires largest memory space...so unions are useful for applications involving number of variables, where values need not be assigned to all elements at one time.  

  4. C • What are the differences between malloc() and calloc()? -> First, is in the number of arguments. malloc() takes a single argument (memory required in bytes), while calloc() needs two arguments. -> Secondly, malloc() does not initialize the memory allocated, while calloc() initializes the allocated memory to ZERO.

  5. C • What is an Enumeration? An enum is a user-defined type consisting of a set of named constants called enumerators. The colors of the rainbow would be mapped like this enum rainbowcolors { red, orange, yellow, green, blue, indigo, violet) }

  6. C • Where are the auto variables stored? if by "auto", you mean system, variables are stored in memory. In fact, a large number of variables in code are stored in memory, because using memory is faster.

  7. C • Write a program to swap two numbers without using a temporary variable. • a=a+b; • b=a-b; • a=a-b;

  8. C • How to swap two numbers using bitwise operators? • a = a ^ b • b = a ^ b • a = a ^ b

  9. C • What is the purpose of main( ) function? • It is the starting function • Recursive call is allowed for main( ) also. • It is a user-defined function • Program execution ends when the closing brace of the function main( ) is reached. • It has two arguments 1)argument count and 2) argument vector (represents strings passed).

  10. C • difference between declaring a variable and defining a variable? • Declaring a variable means describing its type to the compiler but not allocating any space for it. • Defining a variable means declaring it and also allocating space to hold the variable. You can also initialize a variable at the time it is defined.

  11. C • What are the differences between formal arguments and actual arguments? • The arguments passed to the functions while the function is called is known as the actual arguments. • Whereas the arguments declared in the function header is called as formal arguments.

  12. What is a pointer?

More Related