char name[] is an array of chars whereas char *name points to a string literal whcih you can't change. It's read only marked by the OS.
Type: Posts; User: BEN10
char name[] is an array of chars whereas char *name points to a string literal whcih you can't change. It's read only marked by the OS.
Try pressing ALT+ENTER
So the time complexity will be O(n)?
Oh, now I think I got the mistake in my code using static variable. Thanks.
But can you tell me how to compute "O" for the code given by you. Also frankly speaking I'm getting problem in tracing...
I made a code to count the total number of nodes in a binary tree.
int count(struct node *root)
{
static int i=0;
if(root!=NULL)
{
count(root->left);
i++;
-> requires pointer to the structure on it's left side, whereas the '.' operator requires a structure variable on it's left side not a pointer.
Eg.
struct book
{
int page;
char name;
float...
Why do you need pointer for that? It can be done using one loop only.
I dont know about anything else but remove the '&' from the 2nd and 3rd scanf() calls.
scanf("%s",fname);
scanf("%s",lname);
For 2's complement, look here.
Let me explain it with a 16bit arithmetic. The value of INT_MIN for it will be -32768 and INT_MAX will be 32767. Thus when you negate INT_MIN you get 32768 but this can't be represented in it coz the...
I'm not getting any error or warning with the first code.
You cannot define a function inside another function. You just call it there. You should also have a prototype declaration after the headers have been included.
@MK27
This might be of some help to you.
Ohhhhh......I was assuming it just an int.
Since remainder==0 so the condition of while will become false and thus doesn't get executed.
Dont you think a * with (s->top) is illegal coz the value of top will be given by s->top if top is a member of struct having pointer s?
The *(related to pointer) operator is the "value at address" operator. So, whenever there is a pointer then you can use the * operator to find the value at the address pointed to by the pointer.
Here
I copy-pasted your code and ran it. I got the result you were expecting and not the one you're getting. Which compiler are you using?
EDIT: There is a library which you can include <math.h>. The...
Dont use feof. It might be causing the problem.
I found a link where it has been discussed.
bitwise on floats
LOL.:)
Floats are real numbers, they have a decimal point whereas ints are pure integers with no decimal point. '&' and '>>' are bitwise operators that require int, char, short or long as their arguments,...
The code is getting executed so fast that the time is always coming out to be 0.000000.
According to me it goes like this.
You can't fulfill everyone's requirement, so there comes a term *majority* to whom I was addressing. I know that it was my fault not attaching it as a jpg file but...