char foo='f';
char *pc;
char **ppc;
pc=&foo;
ppc=&pc;
printf("pc -> %p\n",pc);
printf("&pc -> %p\n",&pc);
printf("ppc -> %p\n",ppc);
Type: Posts; User: dude543
char foo='f';
char *pc;
char **ppc;
pc=&foo;
ppc=&pc;
printf("pc -> %p\n",pc);
printf("&pc -> %p\n",&pc);
printf("ppc -> %p\n",ppc);
This expersion will alway be true !!!
if( b[j+acount]!='!'||b[j+acount]!='\0')
lets test with j = 0 and acount = 0, then we get to test
if ( b[0] != '!' || b[0] != '\0' )
How hard is it to implent bubble sort on
a single linked list ?
By hard I mean, that we will have to write diffrent
code for each private case. Like if the list contains
only two juctions and...
So we must always test pointers against NULL ?
char buf[] = "abc";
char *p;
p = strchr(buf, 'z');
/* This is wrong ? */
if ( ! p )
No. Just reverse the list. ( not the data, but the pointers)
In the function "distance" replace
dist = grid[x][y];
with
dist = grid[x-1][y-1];
core file is the process image at time of recvinig the signal
seg fault.
Its very easy to look at the debuger manuall and learn how to work with
core files.
But anyway , using calloc , the space is initializied to zero.
to loop the array :
int i;
for( i = 0; i < db->ncountries; i++ )
db->list[i] = NULL;
/* or
You must learn to work with core files.
core file is the process image at time of recvinig the signal
seg fault.
Hellow !!! this is a c forum not c++.
I only looked at the beging of the program.
Look throw the code, looking for the word "Error".
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <limits.h>
For every address returned by malloc :
In order to free memory use the function free().
like
char *p;
if ( ! ( p = malloc(20)) )
{
> Newbie needing help -- I am writing a program to implement sorting alogrithms and think what I have is correct (feel free to double check me!). Where I am have problems is as part of the assignment...
Thanks Dave_Sinkula. Now I can see it.
> How can i sort strings using insertion sort?Is it possible?Coz i only understand this simply sort and im running out of time now...pls help..thanks
You...
For the link
> http://cboard.cprogramming.com/showthread.php?t=78605
why do I get :
"dude543, you do not have permission to access this page." ?
The easiset way is using qsort.
What is the exe you trying to run ?
Scan the string.
Loop throw it until you find '\n' or '\0' and overwrite with '\0'.
Bare in mind, the seconed argument to strtok will be replaced
by NULL's.
The best thing to do is keep abuffer with the orignal string
in it.
So . as told earlier. Function prototypes should be posted
in the beging of the file.
You don't need to prototype library functions like malloc, and
you might get errors from doing it. Use...
Sorry but I get :
1 8 10 11 12
You already have the ascending, does'nt it give any idea
how to do the descending ?
Hint : try to follow the same logic.
num shold'nt be set to EOF !!!!
The return value from scanf , should.
Also, close all streams you opened.
This the basic code :
extern int errno;
I would suggest somting simpler
int n = sizeof(arr)/sizeof(arr[0]);
int i, strt, j;
i = 0;
while ( i < n - 1)
[QUOTE]
im finding that kernhigan and ritchie is not very good for me
[\QUOTE]
I must agree with you. Try to find some beginer book.
Just fix the function main. Go by the comments
int main(void)
{
/* Dont need head */
list_pointer *head;
/* Not just "Node" but "struct Node" */
Is this the "X files" ?
first of all, main should look like this
int main(void)
{
int result;