What will be the prototype of a user defined function?
In C programming, there are no built-in functions; all functions are user-defined. In order to use a function it must first be declared. This can be achieved by importing the header file containing the declaration (via the #include compiler directive) or by typing the declaration by hand.
The definition (implementation) of a function is not required in order to use a function, but if a function is used it has to be defined somewhere (undefined functions will cause a link error). Where a function is used by several translation units, placing the declaration in a header file ensures the declaration is consistent across all translation units. Grouping declarations by purpose allows us to import several declarations at once. Declarations that are not used are simply ignored.
A declaration informs the compiler of the function's name and type, and the number and type of its arguments, if any. This describes the interface to the function. A function's type is denoted by its return type. A function that has no return value is simply declared void (no type). The return type always comes first in a declaration, followed by the function name, which must be a unique identifier within the scope in which it is declared (global or local scope). A local name will mask a global name, effectively hiding it from the local scope.
Function arguments (the formal arguments of the function) are delimited by parenthesis after the function name. A single argument of type void denotes no arguments while multiple argument types must be separated by commas (void types are not permitted in a multiple argument function). The complete declaration is terminated by a semi-colon immediately after the closing parenthesis. If the declaration is also a definition, the function body (the implementation) replaces the closing semi-colon.
To assist with documentation, the formal arguments of a declaration may be named (unless the argument is void). However, where names are given, they need not match the corresponding names provided by a function's definition, where defined separately. Using longer descriptive names in the declaration helps document their purpose, while the definition can use shorter names that are easier to work with.
What is a green operators license disc?
A green operator's license disc is a permit issued by certain regulatory authorities, allowing operators of vehicles, particularly in the transportation sector, to legally operate their vehicles under specific environmental standards. The green color typically signifies compliance with eco-friendly practices, such as reduced emissions or the use of alternative fuels. This disc is often displayed on the vehicle to indicate its adherence to regulations aimed at promoting sustainability and reducing environmental impact.
What is the difference between runtime errors and compile time error?
Compile time errors occur do to syntax errors (such as forgetting a semi-colon at the end of a line) and they prevent your program from even compiling.
A runtime error is an error in logic in your program. Your program will compile, however while running the program it will throw an error because it tries to do something illegal (such as dividing by 0).
Why is this statement an example of faulty logic?
Its not a statement of faulty logic because it is a question not a statement, also its not comparing anything so that is why i think its not a faulty statement
There is no need to assume the length if the sentence is represented by a null-terminated string. The following function will strip out all the vowels in any null-terminated string of any length, returning the number of vowels removed. Note that we don't create a new string, we simply modify the existing one since we know the modified string cannot be any longer than the existing one. If you want to retain the original string, simply make a copy of it before invoking this function.
The p variable is a pointer and will initially refer to the first character of str, which is also a pointer. The cnt variable maintains a count of the vowels we removed. We use the str pointer to advance through the string one character at a time. When str is referring to a vowel we simply advance str to the next character leaving p where it is (effectively ignoring the vowels) and increment cnt. When str refers to a non-vowel, we copy the character from str to p and advance both pointers. When str reaches the null-terminator, we place a null-terminator in p and return the value of cnt.
If any vowels were found there will be cnt characters beyond the new null-terminator. If the original string was a fixed-length array then you cannot remove these extra characters, but for variable length strings you may wish to reallocate, reducing the size of the allocation by cnt characters.
int strip_vowels (char* str)
{ char * p = str;
int cnt = 0;
if (str==NULL) return cnt;
while (*str != '\0') // test for null-terminator
{
switch (*str) // test for vowels
{
case 'a': case 'A':
case 'e': case 'E':
case 'i': case 'I':
case 'o': case 'O':
case 'u': case 'U':
str++; // str refers to a vowel, so ignore and advance to next character
cnt++; // increment the count
break;
default:
*p++ = *str++; // non-vowel -- copy the character and advance both pointers
break;
}
}
*p = '\0'; // ensure the modified string is null-terminated!
return cnt;
}
* Enables real-time, deterministic scheduling and task prioritization
* Abstracts away the complexities of the processor
* Provides a solid infrastructure constructed of rules and policies
* Simplifies development and improves developer productivity
* Integrates and manages resources needed by communications stacks and middleware
* Optimizes use of system resources
* Improves product reliability, maintainability and quality
* Promotes product evolution and scaling
What is a Virtual PBX and what is the function of a Virtual PBX?
A virtual PBX is a phone exchange that serves a specific office or building, as opposed to one that a common carrier or telephone company operates for many businesses or for the general public.
Write a program that would find the count of occurrence of largest digit in the input number?
#include
#include
void main()
{
long int n,r,m,max=0,count=0;
clrscr();
printf("Enter the Number:");
scanf("%ld",&n);
m=n;
while(n>0)
{
r=n%10;
if(r>max)
max=r;
n=n/10;
}
printf("\nLargest Digit is = %ld",max);
while(m>0)
{
r=m%10;
if(r==max)
count++;
m=m/10;
}
printf("\n\nOccurence of Largest Digit %ld is = %ld",max,count);
getch();
}
output:
Enter the Number:68596999
Largest Digit is = 9
Occurence of Largest Digit 9 is = 4
How do you choose multiple if statement and switch statement?
If you must evaluate two or more expressions separately, use multiple if statements. If you only need to test all the possible evaluations of a single expression, use a switch.
Write a program to implement parity bit checker?
# include
# define bool int
/* Function to get parity of number n. It returns 1
if n has odd parity, and returns 0 if n has even
parity */
bool getParity(unsigned int n)
{
bool parity = 0;
while (n)
{
parity = !parity;
n = n & (n - 1);
}
return parity;
}
/* Driver program to test getParity() */
int main()
{
unsigned int n = 7;
printf("Parity of no %d = %s", n,
(getParity(n)? "odd": "even"));
getchar();
return 0;
}
CODING BY:SONU BARNWAL CENTRAL UNIVERSITY OF BIHAR
How do you make a program of a game by using the C programming language?
Typically you won't use C to write games, particularly non-trivial games. C++ is the language of choice for most game developers.
What property states if a equals b and b equals c then a equals c?
Transitive Property
That's called the transitive property.
Can you use a commit statement within a database trigger?
1. As with any other use of transactions - to ensure a collection of commands within the trigger are executed in a repeatable way in the event of failure.
2. To 'undo' the process that caused the trigger to fire. For example, the trigger might be doing some additional integrity checks and issuing a rollback to undo the initiating update/delete.
---------
AnswerCome to think of it, I have never seen a commit on triggers. Triggers as you know are a last line defense based on an action that was carried out by an insert,update or delete. Hence, since the trigger exists on the server, and is only fired if one of the above conditions are executed then it seems pointless to use a commit in the trigger. Also commit goes along nicely with transactions where you begin the transaction and if all is well then you issue a commit, else if the transaction fails, then you issue a rollback.What are the main features of arrays. How are arrays used and created?
In programming languages, an array is a way of storing several items (such as integers). These items must have the same type (only integers, only strings, ...) because an array can't store different items. Every item in an array has a number so the programmer can get the item by using that number. This number is called the index. In some programming languages, the first item has index 0, the second item has index 1 and so on. But in some languages, the first item has index 1 (and then 2, 3, ...).
Why do pointer occupy only 2 bytes of memory in 16 bit DOS environment?
You've answered your own question, I'm afraid. A 16-bit memory address requires 2 bytes of storage (8 bits * 2 bytes = 16 bits). Note that, without using XMS or EMS, you can only address 2^20 bytes of memory, with the last 384k or so being restricted (BIOS, video, etc) unless you enable the A20 line (it actually wraps from FFFF:0010 back to 0000:0000). Also, you should note that 16-bit pointers work because of a "segment:offset" feature; your current "data segment" determines where in memory your pointer actually points to. If you need a 4-byte pointer, use a far pointerinstead; these pointers can reference any point in memory (up to the aforementioned 1MB limit).
How do you find the second largest number among n numbers without using an array in c?
#include<stdio.h>
main()
{
int n,m,i,max;
printf("How many numbers(n) you going to enter:");
scanf("%d",&n);
printf("Enter the numbers:");
scanf("%d",&m);
max=m;
for(i=2;i<=n;i++)
{
scanf("%d",&m);
if(m>max)
max=m;
}
printf("The Largest Number is %d",max);
}
Here is a code with explanation and dry run hope it can be helpful
http://fahad-cprogramming.blogspot.com/2014/04/find-maximum-and-minimum-number-in.html
How do you Become a Chief Operator?
To become a Chief Operator, typically one must first gain experience in the relevant industry, often starting in entry-level positions and progressing through roles such as operator or supervisor. Pursuing a degree in a related field, such as engineering or operations management, can enhance qualifications. Additionally, developing strong leadership, problem-solving, and communication skills is essential, as Chief Operators oversee operations and lead teams. Networking and seeking mentorship within the industry can also facilitate career advancement.
What is the pseudo-code for finding all the factors of a positive integer?
The simple (brute-force) way to do it would be something like this:
For every integer i from 2 to n-1 do:
If n modulo i equals 0, output i.
This would be very slow for large n (linear in the size of n, in the best case).