What is diffrence between statement and expression in c?
well , in a rather simple way
an expression is a combination of of literals , variables , operators , functions calls which produces a particular value to be used in any other context
while a statement is an instruction to the computer telling it what to do for instance assigning an expression value to a variable , cause it produces an instructions tells the computer to assign a value to something.
to be more accurate , you can tell if A is a statement or an expression accurately by looking at the context which is been used in
well , in a rather simple way
an expression is a combination of of literals , variables , operators , functions calls which produces a particular value to be used in any other context
while a statement is an instruction to the computer telling it what to do for instance assigning an expression value to a variable , cause it produces an instructions tells the computer to assign a value to something.
to be more accurate , you can tell if A is a statement or an expression accurately by looking at the context which is been used in
What are the different types of array explain with examples?
There are two main types of array:
1) Single dimensional array: These are arrays for which only one index is required to access the element stored in an array. They are stored in a contiguous memory location.
Eg:
int arr[10];//declaration
arr[7] = 7;//initialization
2) Multidimensional array: These are arrays for which more than one index is required to access the element stored in a specific location in the array. These are stored in a contiguous memory location row-by-row.
Eg:
int arr[5][5];//two dimensional array
int arr[5][5][5];//three dimensional array
Use and importance of programming languages?
Answer If it weren't for computer languages where would we be today. Can you imagine writing a program as simply as writing a sentence instead of using computer language, it would be impossible. CD/delete means one thing, CD:/change direction and if the double dots aren't there the computer won't recognise the command. That's why so many people especially Computer Programmers spend years in Schools learning computer language so that the every day joe can't do their jobs.
Algorithm and flow chart of the program for ascending and descending order of numbers?
Use a looping structure. The first step initialises a loop control variable, n, to zero. You then begin the loop by processing the nth element from the array (the process may be a simple print statement). You then increment n. Finally, you test the value of n; if it is less than 10 you start a new iteration of the loop, otherwise you proceed to the end of the flowchart.
Write a c program to print the sizes and ranges of different data types in c?
#include<stdio.h>
#include<conio.h>
void main()
{
float f1,*Ptr1,*Ptr2;
ptr1 = &fl;
ptr2 = (&fl+1);
printf("%u",(char *)ptr2-(char *)ptr1);
getch();
}
What is the default value of integer in c?
For static and global variables it is 0; automatic variables are not initialized by default.
in the c language there is no default value for non static local variables. The variable holds whatever was in memory before it became a variable. It's best to always initialize a non static local variable before using it in the c language (or at least before comparing it to something else). Also It's best to assume that there is no default value because this varies from language to language, and hardware to hardware.
Cheers!
How do you swap 2 variables without using third variable?
void main() { int a,b; clrscr(); printf("\n\n\t\tenter any two nos..."); scanf("%d%d",&a,&b); a=a+b; b=a-b; a=a-b; printf("\n\n\t\tvalue of a=",a); printf("\n\n\t\tvalue of b=",b); getch(); }
A language that allows you to combine high-level programming with low-level programming. C and C++ are generally regarded as being mid-level languages.
Who is the owner of c language?
C language eveloped by Dennis Ritchie at the Bell Telephone Laboratories.
What is the difference between initialisation and definition in C programming?
Variable-declaration is:
extern int x;
extern double y;
extern char a;
Variable-definition is:
int x;
static double y;
auto char a;
Variable-definition with initialization is:
int x = 1;
static double y= 2.3;
auto char a = 'w';
How do you print numbers from 2 to1000 using while loop?
int i = 2;
while (i <= 1000) {
printf ("%d\n", i);
i++;
}
A procedural language is a programming language in which everything is processed in the order it appears to the computer.
In contrast, an object-oriented language is a language in which everything is processed depending on what happens in the program -- user input, errors, or other events.
PHP is both a procedural and object-oriented language, depending on the way it is used.
A java do while loop to count even numbers from one to ten?
The while loop is good for scenarios where you don't know how many times a block or statement should repeat, but you want to continue looping as long as some condition is true. A while statement looks like this:
while (expression) {
// do stuff
}
In this case, as in all loops, the expression (test) must evaluate to a boolean result. The body of the while loop will only execute if the expression (sometimes called the "condition") results in a value of true. Once inside the loop, the loop body will repeat until the condition is no longer met because it evaluates to false.
Any variables used in the expression of a while loop must be declared before the expression is evaluated. In other words, you can't say
while (int x = 2) { } // This is not legal
The key point to remember about a while loop is that it might not run at all. If the test expression is false the first time the while expression is checked, the loop body will be skipped and the program will begin executing at the first statement after the while loop. Look at the following example:
int x = 8;
while (x > 8) {
System.out.println("in the loop");
x = 10;
}
System.out.println("past the loop");
Running this code produces
past the loop
Because the expression (x > 8) evaluates to false, none of the code within the while loop ever executes.
What is the difference between AI and conventional programming?
Artificial Intelligence
*primary symbolic process
*Heuristic search
-steps are implicit
*Control structure usually separate from the domain knowledge
*usually easy to modify update and enlarge
*some incorrect answers are tolerable
*satisfactory answers usually acceptable
Conventional Programming
*numeric
*Algorithmic--steps are explicit
*information and control are integrated together
*difficult to modify
*correct answers are required
*best possible solution usually sought
How do you write a program in c to calculate age?
//program to find the age of given date of birth
#include <dos.h>
#include <stdio.h>
int main(void)
{
struct date d;
int bd,bm,by,day,m,y,cd,cm,cy;
clrscr();
getdate(&d);
printf("\t**********WELCOME TO AGE FINDER PLACE************\n");
printf("\t*************************************************\n\n");
cd=d.da_day;
cm=d.da_mon;
cy=d.da_year;
printf("Enter the birthe date : ");
scanf("d%d",&bd,&bm,&by);
{
if(cd<bd)
{
cm=cm-1;
cd=cd+30;
day=cd-bd;
}else
day=d.da_day-bd;
}
{
if(cm<bm)
{
cy=cy-1;
cm=cm+12;
m=cm-bm;
}else
m=d.da_mon-bm;
}
y=cy-by;
printf("your age is:-\n");
printf("year=%d\tmonth=%d\tday=%d\n",y,m,day);
getch();
}
//by DILKASH
from MANUU
What factors determine the structure and content of a training program?
The organizational structure, work activities, and informational content identified in a job analysis serve as the basis for developing both the structure and content of a training program
How can you get how much memory is available using c program?
You don't say whether you mean physical memory or virtual memory. Regardless, there is no portable method given that memory management is system-specific. However, the system should provide some means of giving you the information you need. The following example works on Windows and Linux:
#ifdef WIN32 #include <windows.h>
unsigned long long getTotalSystemMemory()
{
MEMORYSTATUSEX status;
status.dwLength = sizeof(status);
GlobalMemoryStatusEx(&status);
return status.ullTotalPhys;
}
#else // UNIX...
#include <unistd.h>
unsigned long long getTotalSystemMemory()
{
long pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGE_SIZE);
return pages * page_size;
}
#endif
What two steps are needed to create an array?
For example we have a class :
public class Test()
{
public void print()
{
System.out.println("Hello");
}
}
So, if you want to create array from Test type. You can try something like this :
Test[]myTestArray=new Test[2];
myTestArray[0]=new Test();
myTestArray[1]=new Test();
I hope it will help.
Draw a flowchart to find the sum of given n positive numbers in c?
What is the flowchart C program to check wether a given character is vowel or not using switch case?
Switch case can be flowcharted using a diamond for each case, with a right branch for true and a down branch for false. The false branch simply connects to the next case. The true branch connects to the statement that should be executed for that case. Where multiple cases result in the same statement, the true branches should converge upon that statement. The execution path from the statement(s) should converge with the final false branch of the switch case.
In this case, your switch case might be as as follows:
print %letter%
switch lowercase (%letter%)
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
print line " is vowel"
break;
default:
print line " is not vowel"
}
Thus you will have a column of diamonds for each case with false branches linking downwards from one diamond to the next. The statement for case 'a', 'e', 'i', 'o' and 'u' is the same, so their true branches (extending to the right) will converge upon the 'print line " is vowel"' statement which must be placed to the right of the case diamonds. The default case's true branch leads to the 'print line " is not vowel"' statement. Both these statements will then converge with the false branch from the default case, marking the end of the switch case.
Note that, logically, there is no false branch from a default case, thus this link may be omitted. However, all links from all statements must still converge below the default case.
Are there different types of skateboards?
Yes there are good brands of boards such as element, baker, birdhouse, active and DVS.
Definition of Identifier in C Language?
Identifiers or symbols are the names you supply for variables,type,function and labels.Identifiers names must differ in spelling and case from any keyword.you cannot use keyword as an identifier.you can create an identifier by specifying it in the declaration of a variable,type or function.
7 Write a program to append one file at the end of another?
#include
#include
void main()
{
FILE *fp1,*fp2;
char ch,fname1[20],fname2[20];
printf("\n enter sourse file name");
gets(fname1);
printf("\n enter sourse file name");
gets(fname2);
fp1=fopen(fname1,"r");
fp2=fopen(fname2,"a");
if(fp1==NULLfp2==NULL)
{
printf("unable to open");
exit(0);
}
do
{
ch=fgetc(fp1);
fputc(ch,fp2);
}
while(ch!=EOF);
fcloseall();
}
Write an algorithm and Draw a flowchart to accept two numbers and display the sum of the numbers?
#include
using std::cout;
using std::cin;
using std::endl;
int main()
{
double firstNumber = 0;
cout << "Enter first number: ";
cin >> firstNumber;
double secondNumber =0;
cout << "Enter second number: ";
cin << secondNumber;
cout << "Sum of the two numbers is: " << (firstNumber + secondNumber) << endl;
return 0;
}