C Programming - Functions - Discussion

Discussion Forum : Functions - General Questions (Q.No. 2)
2.
What is the notation for following functions?
1.  int f(int a, float b)
    {
        /* Some code */
    }

2.  int f(a, b)
    int a; float b;
    {
        /* Some code */
    }
1. KR Notation
2. ANSI Notation
1. Pre ANSI C Notation
2. KR Notation
1. ANSI Notation
2. KR Notation
1. ANSI Notation
2. Pre ANSI Notation
Answer: Option
Explanation:
KR Notation means Kernighan and Ritche Notation.
Discussion:
59 comments Page 2 of 6.

Uma said:   1 decade ago
What is notation?

Rahul said:   1 decade ago
main()
{
char *p="hai friends",
*p1;
p1=p;
while(*p!='\0') ++*p++;
printf("%s %s",p,p1);
}

What will be the o/p explain with steps please?

Mahmoud said:   10 years ago
Write a compete C program that prompts the user to enter an observed boiling point of a substance.

In °C (Celsius), then the program identifies the substance depending on its observed boiling point within the error rate er% lower or higher of the expected boiling point.

If the data input (observed boiling point) is not close within er% higher or lower than any of the boiling points in the table below, the program should output the message unknown substance.

Your program also should define and call a function called within_ percent that takes three. Variables as input arguments and return an integer value as an output.

int within_percent (int reference, int data, double percent_val).

This function works as follows:

It returns 1 (true) if data is within percent_val % of reference.

In other words:

(reference " percent% * reference) % data % (reference + percent % * reference).

Otherwise the function return zero (false).

For example: Calling within_percent (357, 352, 7.5) would return 1 (true), since 7.5%.

Of 357 is 26.7 and 352 falls between 330.22 and 383.7.

Substance Normal boiling point (°C) Error rate (er%).

Water 100 5.1.

Mercury 357 7.5.

Copper 1187 6.2.

Silver 2193 6.9.

Gold 2660 5.3.

Khan Fatema said:   10 years ago
What is the mean of all these notation?

Avinash said:   9 years ago
Please explain the notation properly.

Hareesh said:   9 years ago
One of the aims of the ANSI C standardization process was to produce a superset of K&R C (the first published standard) incorporating many of the unofficial features subsequently introduced. However, the standards committee also included several new features, such as function prototypes (borrowed from the C++ programming language), and a more capable preprocessor. The syntax for parameter declarations was also changed to reflect the C++ style.

Ponnuvel said:   9 years ago
Thanks @Mahender.

Silpa said:   9 years ago
Good explanation @Mahender. Thank you.

Yogesh said:   9 years ago
Purpose of notation is?

Pawan said:   9 years ago
What is KR notation?


Post your comments here:

Your comments will be displayed after verification.