I'm having a hard time grasping this code
#define N 10
int a[N], i, sum = 0, *p = a;
for (i = 0; i < N; i++)
sum += p[i];
Type: Posts; User: danieldcc
I'm having a hard time grasping this code
#define N 10
int a[N], i, sum = 0, *p = a;
for (i = 0; i < N; i++)
sum += p[i];
how about using
for(;;)
instead of the while loop
right, but I'm trying to avoid using the "== somevalue" that you have there
so how do I return false if values from 0 to 100 are true and I still want to use if(myfunction()) without the == part...
but then how would
int delete (struct data_node **, int);
if(delete(&first, data)) //so how would this determine if I want to return value of int 0 as in TRUE, or just return 0 for FALSE?
so basically
a = 0;
return 0;
is different from
return a;
?
if i'm returning an int from a function and I want to return 0...why does this work
return (0); --> for false
return a; --> if a equals 0, return is still true and works fine but i don't know...
Wow, great, I think some of this stuff is finally starting to sink in...thank you.
// Return the number of nodes in a list (while-loop version)
int Length(struct node* head) {
int count = 0;
struct node* current = head;
while (current != NULL) {
count++;
current =...
yep got it. tks
Hey, I'm trying to return the position of the array so I can print the contents of a structure at that position, I run in to the problem of what if the array position is 0? This is a problem cause I...
hhmmmm i changed function name and worked, now i changed function name back and works again? wtf? i'm using cygwin, is there a bug?
Anyone know why I can't pass the structure to the function this way????
#include <stdio.h>
#include <string.h>
void diplay_jock(athlete players) {
I took salem's advise and got it working perfectly
char *end = str + strlen(str);
while ((temp = strchr(temp, value1)) != NULL && (temp +2) < end)
Now, another part of questions asks...
Ok. cool...that looks like a better way of doing....for my learning curve though, do you know why what I didn't doesn't work?
Ok. so I'm writing up the below assignment and have a little snag in the code
• takes command line arguments of one string and two single characters
• locates the first character in the string: if...
ok i think i got it. this is right? right?
#include <stdio.h>
#include "max_sizes_b.h"
int main (void) {
int A[MAX_L][MAX_N], B[MAX_M][MAX_N], C[MAX_L][MAX_N], i, j, l, m, n;
no, wait, I think something is wrong with my code......let me work on it some more
so I think everything is good in my code, except when i print I get a few funny numbers. I think because the numbers are too big to be integers. How do I effectively convert them to show up properly...
ah, pointer stuff is a little confusing, but thanks for the help....
#include <stdio.h>
void test(int *p) {
*p = 20;
Just testing and getting warnings. Still compiles but not sure why warning?
#include <stdio.h>
void test(int *p) {
int a = 20;
*p = &a;
No closer to a solution? I got my solution already I believe.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define ROWS 10
#define COLS 10
tks quzah
hahahhahahahahaahah, lol, i'm an idiot!!!
tks
think that i'm getting this wrong but from what i understand this means.....
the value is true as long as ch does not equal '.' or '!' or '?'
why does this work
printf ("Please enter a sentence");
while ((ch = getchar()) != '.') { //i know that '\n' would terminate on new line character
if (ch == '.' || ch == '!' || ch == '?') ...