What is the function of a statements?
Statements serve to convey information, assert facts, or express opinions in both written and spoken forms. They are fundamental building blocks of communication, allowing individuals to share ideas, provide clarity, and facilitate understanding. In programming, statements execute specific actions or commands within a code, guiding the flow of operations. Overall, statements play a crucial role in articulating thoughts and executing processes across various contexts.
The declaration 'int a' both declares the variable of 'a' and allocates memory for it.
When you use 'extern' you are referring to a variable called 'a' that has its memory allocated in another module. The actual variable 'a' is not in the same compilation unit as the current one being compiled. Where the variable 'a' is located is resolved by the linker.
When using 'extern' you state your intent to use a variable called 'a', but it doesn't reserve any memory for it in the current module.
Write a program in c to find the largest no out of a matrix of order mn?
/* using ellipses (...) to indicate tabs for clarity */
double largest (double *array, int M, int N) {
... int i, j;
... double *element;
... double answer = array[0][0];
... for (i=0; i<M; i++) {
... ... for (j=0; j<N; j++) {
... ... ... element = array + i*M + j;
... ... ... if (*element > answer) answer = *element;
... ... }
... }
... return answer;
}
How do you swap two variables using bitwise operators?
a := a XOR b
b := a XOR b
a := a XOR b
it works, but never use it in real programs
do you know why its not used in real program??
Since this is likely a homework question, what will be provided here instead of code is information that you can use to write the code. (Half of the fun of programming is the problem solving and associated trouble shooting.)
Firstly, you need to know what kind of interface the application uses: console or graphical. That'll help you determine how you'll receive the information from the user (input) and how you're displaying the results (output).
Secondly, you know that you need comparison operators and a for() loop. Since "n" is the number of values you'll accept from the user, and say "c" is the counter value, your loop will look something like: for (c=0; c<n; c++) { [your code here] }
Then you'll need four additional variables:
- one to accept the user's data;
- one to store the number from the user;
- one to store the largest value;
- one to store the smallest value.
Be sure to initialise the largest value to the smallest number you can store, and the least value to the largest number you can store. I don't know which type you're instructed to use, but for a 32-bit "int" you're looking at a range of -2,147,483,647 to 2,147,483,648.
Also, the reason you need two variables for storing the user's inputs is because the user might enter non-numeric data. So store the user's input in a char[] array, then use atoi() to convert that into an integer, and you'll be able to avoid any problems with types since atoi() ignores everything after and including the first non-digit character.
Once you've got that number, compare it with the current largest value - if the user's number is greater, set the largest value to that number. If the user's number is lower than the least number, set the least number to that value.
Once the loop is finished, simply display the results, and you're done!
Program to implement strdup in C?
char *strdup (const char *s)
{
size_t len;
char *p;
if ( !s )
return NULL;
len = strlen (s);
p = malloc (len+1);
if (p && len)
{
memcpy (p, s, len);
p[len] = '\0';
}
return p;
}
Input and output should be trivial; the core of it is: m = (n<<3)>>5
Note: it is not the same as m = n>>2
What is the difference between structure and structure using typedef with example?
Consider the following structure:
The name of this type is struct data_t. This means that we must include the struct keyword whenever we declare any instances of the type or declare a pointer to the type:
To remove the verbosity of the otherwise redundant structkeyword, we can use an alias:
To simplify things further, we can combine the alias with the structure's definition:
Note that the _t suffix is conventionally used to denote a user-defined type as opposed to an alias. However, its usage is not consistent. For instance, the wchar_t type is not a type, it is implemented as an alias in the
In C++, the typedef keyword is not required; it is retained purely for backward compatibility with C. Aliases are introduced with the using keyword, never with typedef. We only use typedef when we are explicitly writing code intended for compilation under both C and C++.
Note also that wchar_t (amongst others) is a built-in type in C++, so we don't need to include the C standard library to make use of it, unless we are writing code for C.
Explain the concept of Master-Child relationship with example tables of your own?
This page demonstrates the concept of Master-Child (Parent-Child) relationships with the help of a GridView and DetailsView control. You select any customer type in the GridView control; all records related to that particular type will be listed in the DetailsView. Then you can make Insert, Edit, Update and Delete functions in the DetailsView. {| ! scope="col" | Customer Type ! scope="col" | Select | Retailer Select Wholesale Select |}
What is the difference between circular linklist and linklist?
In a circular linked list every node is connected to another node. In a non-circular linked list. There are definitely starting and ending nodes are lacking an incoming and outgoing link, respectively.
When function returns a value the entire function call can be assigned a variable?
abay chal short ho yahan se ..
hamai khud nhn pata ....
.. beta aj phare ga .. jamal hussain ...
A variable known only to the procedure in which it is declared is called what?
a procedure-level variable
Is duplicated data is accepted in linked list?
Yes definitely, a linked list can accept duplicate data. As the data of each node does not have any concern with data of other node. The node differs from each other in their addresses. Until user does not make the linked list to accept unique data, the linked list can accept duplicates.
if unsorted (e.g. representig a queue): yes
if sorted (e.g. representing a set): should be decided design-time
How many classes of storage do you have?
In C there are four storage classes: automatic, external, register and static.
Write a program in c to sort the details of 10 students using the structure?
for(i = 0; i < num_students; i ++){
sort(student[i]);
}
That's what you get when you're that specific!
A lexical parameter refers to a variable or argument that is defined in the scope of a specific block of code, typically within a function or method. It is used to pass values into that block, allowing for more flexible and reusable code. Lexical parameters are often associated with closures, where they capture the environment in which they were created, maintaining access to their defining scope even when invoked outside of it.