Can an extern function be defined in a C header file?
Declared is the right word. (Don't define functions in headers, unless you really know what you are doing.)
Assigning a value to a variable in a declaration statement is called?
Answer is; initialization
*** Edit***
Initialization is correct.
Page 59
Programming Logic and Design by Tony Gladdis
Write a C program To check whether given number is a prime number or not?
The brute force way would be to iterate through all the integers smaller than the sought number and check the number is divisible by each of them. However this algorithm is extremely inefficient, but improving upon the simple idea, we can come up with an algorithm:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*
*
*/
int main(int argc, char** argv) {
int checked = 72; //put your number that you want to check
int temp = 2; //the temporary variable to check against
char isPrime = 1; //intially assume it is prime
if (checked != 1 checked != 2) {
while (temp <= sqrt((double) checked)) { //only have to check up to the square root of checked
if (checked % temp 0) {
temp += 1; //only have to check odd numbers } else {
temp += 2; } } }
if (isPrime) {
printf("Checked is prime!\n"); } else {
printf("Checked is not prime!\n"); }
return (EXIT_SUCCESS);
}
or a better edited version here: http://img689.imageshack.us/img689/8164/primecodec.png
Is it necessary to initialize the const variable in c?
A constant variable cannot have its value changed at program run time.
It depends on whether the program responds to a hangup signal or not. If you start the program with a 'nohup' command then it will continue to execute.
What is meant by counting and indexing in assembly language programming?
The Counter Register (RCX and all smaller variants) are used to count loops with a known value, such as counting from 1 to 100. The indexing registers, such as RSI, are used with data manipulation commands, such as reading and writing hardware ports, moving data from one location to another, etc. The term indexing is the same as in other languages, where an index is an offset into an array.
Turbo C example of program that implements Stack?
/*Linked List Implementation of STACK*/
/*Checking of parenthesis in expressions*/
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define M 100
typedef struct node *nd;
struct node
{
char p;
nd next;
}NODE;
void getExpression(char expr[]);
void checkParenthesis(char expr[],int *);
void dispResult(int);
nd top,bottom;
int main(void)
{
char expr[M];
int r;
getExpression(expr);
checkParenthesis(expr,&r);
dispResult(r);
return 0;
}
void getExpression(char expr[])
{
clrscr();
printf("Input an expression: ");
gets(expr);
}
void checkParenthesis(char expr[],int *r)
{
int f=0,l,i;
char e;
nd tp,t;
top = NULL;
bottom = NULL;
l = strlen(expr);
for(i=0;i<l;i++)
{
e=expr[i];
if(e == '(')
{
tp = malloc(sizeof(NODE));
tp->p=e;
if((top==NULL) && (bottom==NULL))
{
tp->next = NULL;
top = tp;
bottom = tp;
}
else
{
tp->next=top;
top=tp;
tp=NULL;
}
}
else if(e==')')
{
if(top==bottom)
{
if(top==NULL)
{
f=1;
break;
}
else
{
top=NULL;
bottom=NULL;
}}
else
{
t=top;
top=top->next;
t->next=NULL;
}
}
}/*end of for loop*/
if(top != NULL)
f=1;
*r=f;
}/*end of function checkParenthesis*/
void dispResult(int r)
{
clrscr();
if(r==0)
printf("The expression has a balance parentheses.");
else if(r>0)
printf("Unbalanced parentheses.");
getch();
}
/*
if(top==bottom)
{
top=NULL;
bottom=NULL;
}
else
{
if((top==NULL)&&(bottom==NULL))
{
f=1;
break;
}
else
{
t =top;
top = top->next;
t->next = NULL;
}
}
}
*/
/*eahjie*/
How to you convert asp to mp3?
simply all you need to do is rename the file , like for example if the file name is ( loveme.asp) rename it to ( loveme.mp3) and that is all you need to do to change the formate.
thank you
Can an float value be assigned to int variable?
Yes, an integer can be assigned as a float value.
But it get stored as a float value, that is an implicit type conversion occurs during compilation.Smaller data types are convertible to larger data types.
eg:
float b=12;// an integer constant is assigned to a float variable
printf("%f",b);// when printing b it will print as 12.000000
An l-value is an expression with an address, named after being able to occur on the left side of the = (assignment) operator. (Technically, a variable declared with a const keyword is an l-value, but cannot occur on the left side of the assignment operator, so the original definition is no longer accurate.)
What information will you find in the Active Work Queue?
Open tasks that I or another user have yet to complete.
How many times will the program will print Language?
Without seeing the program, I can only say: 'zero or more times'
Post decrement is where you decrease the variable by one after using it.
void someFunc(int s) { printf(s); }
void main()
{
int s = 3;
someFunc(s--);
printf(s);
}
will output 3 then 2.
In computer programming, (1) When a number is needed several times in a program, it is good practice to give that number a name. (2) When a name refers to a number that will never change during a run of a program, it is good practice to declare it as a constant before using it.
In most programming languages, we do not define the number of array items as a constant. In many programming languages, it is easy to add items to an array, and an array keeps track of the number of items it holds, which a program can access using something like "array.length" or "array.shape". However, in C and C++ programming, the programmer must define the size of the array at the time it is defined, and the array does not keep track of the number of items it contains. To not define your array would leave the program open to unchecked growth. "Capping" the array with an upper value ensures that, if something goes wrong, you will not crash the application or system. Also, capping the array will make debugging potentially easier. Capping requires using that number in several places, and so (1) tells us it is good practice to give that number a name. Since it is not possible(*) to change the size of an array in C or C++, the number that holds the number of items in the array will never change, and so (2) tells us it is good practice to declare it as a constant. (*) There are a few tricks one can do with malloc() and realloc() that have the same effect as resizing an array, although technically all those tricks merely create a new fixed-size array.
How do you calculate the are of a circle?
To calculate the area of a circle use this formula: pi x r2.
In terms of Air it has to do with which FAA certificate they operate under. For example Part 135 is unscheduled passenger transport.
http://www.talonairjets.com
When variable in c gets memory After declaration or initialization?
Definition.
Example:
extern int x1; /* declaration */
int x2; /* definition */
int x3= 2; /* definition with initialization */
What is the range of integer char float for a 16-bit computer?
Consult your limits.h and math.h.
For char it will be -128..127 or 0.255 (signed and unsigned).
What types of scalar data are typically utilized in cross- tabulation?
Zikmund (2003) described the nominal scale as "a scale in which the numbers or letters assigned to objects serve as labels for identification or classification" (p. 296). The ordinal scale is "a scale that arranges objects or alternatives according to their magnitudes" (Zikmund, 2003, p. 297). Both nominal and ordinal scales are typically utilized in cross-tabulation analysis. (Other types of scalar data would include interval or ratio).
http://www.quickmba.com/marketing/research
-is another website describing nominal and ordinal scales as used for cross-tabulation.
Zikmund, W. G. (2003). Business research methods (7th ed.). Thousand Oaks, CA: Thomson/South-Western.
What can you do when error occurs header file could not open?
You should find out the reason of the problem.
Example:
bad: #include
good: #include