What is function in c with example?



What is function in c with example?..

Answer / Sanjay Kumar Maurya

A function in C is a collection of statements that performs a specific task. Here's an example of a user-defined function:

```c
#include <stdio.h>

void printHello() {
printf("Hello, World!n");
}

int main() {
printHello();
return 0;
}
```
In this example, `printHello()` is a function that prints "Hello, World!" when called from the `main()` function.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Write a program to implement queue.

1 Answers   Aricent,


why u join this call center?

6 Answers   DELL,


what is mallloc()?how it works?

4 Answers   Excel,


What is conio h in c?

1 Answers  


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

1 Answers   TCS,


What is %lu in c?

1 Answers  


write a function to find whether a string is palindrome or not and how many palindrome this string contain?

2 Answers   Aptech,


What does %p mean c?

1 Answers  


code for selection sort?

1 Answers  


Can anyone help me with this please? Need to print the below values.. Thanks 1 1 2 1 2 3 1 2 3 4

3 Answers  


What is the purpose of main() function?

1 Answers  


How do you use a 'Local Block'?

1 Answers   Ericsson,


Categories