How many types of function in C?
Well, it depends on what you mean by the type of a function.
There are user defined functions and library functions.
It is 'flat', and it means unstructured, i.e. it has no segment and offset parts.
In C, there will be a part like this:
char s1[] = "END";
char s2[] = "REVEREND";
size_t l1, l2;
l1= strlen (s1);
l2 = strlen (s2);
if (l1>=l2 && strcmp (s1, s2+(l2-l1))==0) puts ("Yeah");
What was the most important capability of C plus plus that C did not provide?
The most important capability is Object Oriented Programming (OOP) principals, which necessitated the inclusion of classes. That was the main reason Bjarne Stroustrup developed C++ in the first place (indeed, C++ was originally called 'C with Classes').
How can a loop be structured so that it terminates a statement in the middle of its block?
I think you want to use statement break.
Which operator is used 2 access ahidden global variables?
To access a hidden global variable, use the scope resolution operator ::
A capacity swap is what got Qwest and global crossing in trouble with the SEC a few years ago. It basically goes like this: Qwest sells $100,000 in capacity to global crossing In return, global crossing sells $100,000 in capacity to qwest The purchases cancel each other out so no real transaction has taken place Both companies record $100,000 in revenue Clearly these are not really revenues, but it was the result of myopic behavior by the company's CEO's attempting to meet their quotas and in the long run it landed them in hot water
What is my GPA if i have three b's two c's and two a's?
A = 4.0
B = 3.0
C = 2.0
D = 1.0
F = 0.0
Average them.
Write a c program to find factorial non recursive?
/*program for finding the factorial*/
void main()
{
int a,b=1;
clrscr();
printf("Please enter any number to find its factorial\n");
scanf("%d",&a);
while(a>1)
{
b=b*a;
a--;
}
printf("factorial is %d",b);
getch();
}
The simplest way is probably to read the numbers into an array and then prints each element of the array starting at the last one and moving backwards.
Write a c program for profit and loss percentage?
#include<stdio.h>
#include<conio.h>
void main()
{
float cp, sp, p, l;
clrscr();
printf("\n Enter cost price and selling price:");
scanf("%f%f",&cp, &sp);
p=sp-cp;
l=cp-sp;
if(p>0)
{printf("\n The seller has made a profit of Rs.%f",p);
}
else if(l>0)
{printf("\n The seller is in loss by Rs.%f",l);
}
else
{printf("\n There is no loss or no profit");
}
}
i m sure this will help u.....
shalini
A c program to interchange odd and even components of an array?
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,evc=0,odc =0;// sum=0;
clrscr();
printf("enter 10 no.s in the array\n");
for(i=0;i<=9;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<=9;i++)
{
if(a[i]%2==0)
{
evc=evc+1;
}
else
{
odc=odc+1;
}
}
printf("Even nos %d\n",evc);
printf("odd nos %d\n",odc);
getch();
}
0"). This is a perfectly valid and correct approach, but in many implementations, a simple test for the least significant bit ("a[i] & 1") can be more efficient. This also allows to replace logic with arithmetic, which generally is more efficient (i.e. "odc += a[i] & 1")
Stack example in c using push and pop?
http://www.osix.net/modules/article/?id=275
muzzy writes "Here's some code for you kids. It demonstrates the concept of stack, implemented with a linked list mechanism to support virtually infinitely large stack sizes. Happy reading."
/* Simple Dynamically Allocating Stack Implementation in C
*
* Copyright (C) 2002 Muzzy of Worst Coders
*/
How do you create a calculator using c that tells you if the answer to your problem is even or odd?
Well, you'd start by actually coding the calculator part, but at the end, you would test the answer with something like:
if(ans % 2 == 0) {
printf("%d is even.", ans);
} else {
printf("%d is odd.", ans);
}
The percent sign in the if test is the modulo operator. It returns the remainder of dividing the former argument by the latter argument.
In FCFS the processes are in served by the order they arrive and each process will not start until the served process is finished, so if any of the processes got stuck in an infinite CPU loop the whole system will stop and hang.
How do you write a c program to find a2 plus b2 plus 2ab?
{
int a,b;
{
a=a^2;
}
{
b=b^2;
}
{
c=a^2+b^2+2*a*b;
print f("%d%d%d",&c);
get ch();
}
]
What are the disadvantages of nested if in C?
Nothing, but be careful with the dangling else's:
if (cond1) if (cond2) stmt1; else stmt2;
means:
if (cond1) {
if (cond2) stmt1; else stmt2;
}
not this:
if (cond1) {
if (cond2) stmt1;
} else stmt2;
Can two expressions or conditioned be used in while statement?
Yes, it works similar to an IF statement using logical operators.
For instance this would work, but if either of the boolean values were false at the end of the loop it would leave the loop.
bool a = true;
bool b = true;
while (a && b)
{
//run code
}
or: while (exp1 exp2) dosomething
#include<stdio.h>
#include<conio.h>
void main()
{
int num,num_save;
int ar[5],i=0,res_e=0,res_o=0;
printf("\nEnter the number : ");
scanf("%d",&num);
num_save=num;
while(num_save>0)
{
ar[i]=num_save%10;
num_save/=10;
i++;
}
i--;
while(i>=0)
{
if(ar[i]%2==0)
res_e=res_e+ar[i];
else
res_o=res_o+ar[i];
}
printf("\nNumber is %d\n",num);
printf("\nSum of even digits is %d",sum_e);
printf("\nSum of odd digits is %d",sum_o);
getch();
}
How do you calculate space complexity?
Calculate the amount of additional memory used by the algorithm relative to the number of its inputs. Typically the number of inputs is defined by a container object or data sequence of some type, such as an array. If the amount of memory consumed remains the same regardless of the number of inputs, then the space complexity is constant, denoted O(1) in Big-Omega notation (Big-O). If the amount of memory consumed increases linearly as n increases, then the space complexity is O(n).
For example, the algorithm that sums a data sequence has O(1) space complexity because the number of inputs does not affect the amount of additional memory consumed by the accumulator. However, the algorithm which copies a data sequence of n elements has a space complexity of O(n) because the algorithm must allocate n elements to store the copy.
Other commonly used complexities include O(n*n) to denote quadratic complexity and O(log n) to denote (binary) logarithmic complexity. Combinations of the two are also permitted, such as O(n log n).
Why use length function to find length of primitive data type array object?
There is no length function in C. You may have thought of sizeof or strlen. Perhaps.
How is c language different from fuzzy logic?
fuzzy logic is a logic which we have to implement in c language
Write a programme for substraction of two numbers in c language?
substracion of any two number program in c