What is Locale in C?

Question: What is Locale in C? Answer: In an effort to make “C Language” useful throughout the world, standard defines concept of ‘LOCALE’ which specifies a set of parameters for certain things which vary from country to country. ‘setlocale()’ function is used to determine current locale as well as to change the entire locale or … Read more


qsort() and bsearch() Functions in C

This C Tutorial explains qsort() and bsearch() functions in C with examples. ‘qsort()’ function is used to sort an array of values in ascending order. This function is defined in ‘stdlib.h’ header and is prototyped as below void qsort(void *array, size_t no_of_elements, size_t size_of_element, int (*compare)(void const *, void const *)); Notice that first argument … Read more


What is System() Function in C?

Question: What is System Function in Standard C Library? Answer: ‘system()’ function is used to execute SHELL COMMANDS which we can’t use directly in C programs. Note here that program execution doesn’t complete until the COMMAND has completed. This function is defined in ‘stdlib.h’ header and is prototyped as below int system(char const *COMMAND); Note … Read more


getenv() Function in C

Question: What is getenv() Function and What this Function does in a C Program? Answer: An ‘Environment’ is an implementation-defined list of NAME/VALUE pairs maintained by the O.S.. Standard defines specific meanings to “Environment Variables”. Not all implementations necessarily define same set of Environment Variables but they must define same meanings to whatever Environment Variables … Read more


Where is “assert” Macro Primarily used in a C Program

Question: Where is “assert” Macro Primarily Used in a C Program Answer: ‘assert()’ is a macro therefore it doesn’t have a prototype. Yet, we can give following illustration to better understand this. int assert(int expression); ‘assert()’ is useful to test expression argument that ought to be true. If it happens to be false, it displays … Read more


abort() Function in C with Example

This Tutorial explains the abort() function in C with examples. What is abort() Function? abort() Function in C terminates execution of a program abnormally. It’s defined in ‘stdlib.h’ header and is prototyped below Prototype of abort() Function in C void abort(void); Example of abort() Function in C /* abort.c — terminates execution abnormally */ #include … Read more


What is Importance of Volatile Data in Context with Signals

Question: What is Importance of Volatile Data in Context with Signals? Answer: Let’s first understand what an atomic operation is? An atomic operation is one that CPU executes in single unit! For ex. consider, if a machine were 16-bit, it would take one unit to execute an integer which is 16-bit and would take two … Read more


Signal Handlers in C

This Tutorial explains Signal Handlers in C with examples. Signals are mechanisms for communicating with and manipulating processes. Since signals are asynchronous that is they can’t be synchronised with anything in the execution of program. Though signals can either be ignored or responded with default action, we can, however, prepare a program to handle signals. … Read more


Signal Handling in C

Question: What are Different Ways in Which Signals are Handled? Answer: There are three ways defined in which signals are managed. Default way is implementation dependent. Often this is defined to abort the program. SIG_DFL performs the default action for the specified signal. For ex., program terminates when user interrupts the executing program. For example, … Read more


Are the Signals Asynchronous or Synchronous?

Question: Are Signals Asynchronous or Synchronous? Answer: As we know that when program executes performs certain actions, for ex. requesting for input, open some file for read operation, etc. There are events that the program must reach to but these aren’t caused by the program, for ex. interrupts to a program etc. We can’t predict … Read more

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.