- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 3
8 Posted Topics
I am getting many many warnings of this kind in my code. It comes every time I typecast something in my code, which I am doing to variable addresses in order to use integer arithmetic on them. How do I fix these warnings? Thank you! I would appreciate any constructive … | |
Hey DaniWeb. I am getting stuck in an infinite loop when I input a character instead of an integer during a scanf("%d"....); I know this is because C doesn't provide any built in error checking. I know I can fix this by using getchar() in place of scanf, and changing … | |
I am getting a seg fault when I try to run this code. The compiler is also giving me odd warnings about how an integer constant is too long for "long" type. Here is the code: Declarations [CODE] #include<stdio.h> #include<string.h> #include<stdlib.h> void printstates(){ printf("Enter the number for the corresponding state:\n\ … | |
I am getting all sorts of incorrect type warnings when I compile the following code: [CODE]// hw1.c // Josh Soileau // 1/19/10 // Program: Asks / stores info on a bank // #include<stdio.h> int main(){ char name[25] = "blank", rating[25] = "blank", state[25] = "blank"; int lobbyists=0, prevemploys=0, number=0; double … | |
I am very very blurry about when to use pointers or not. I am writing a function (given below), and trying to pass in two variables, statenumber and state. I have them being passed in as chars, and not char *s. I get error messages both ways. I dont know … | |
I am trying to write a function to add two arrays. The catch is that the arrays have to parts of a structure. So here is what I have so far: [CODE]#include <stdio.h> struct poly { array1[]; array2[]; length; }; void polyadd(int array1[],int array2[],int length) { int i; struct poly … | |
[CODE]#include <stdio.h> struct poly { int len; int arr[]; char *name; }; int main() { int i; struct poly p; p.len = 45; p.arr[3] = {1,1,1}; p.name = "Josh"; printf("%d",p.len); for(i = 0; p.arr[i] != NULL ; i++) printf("%d",p.arr[i]); printf("%s",p.name); return 0; } [/CODE] I tried to make a simple … | |
I am trying to implement my own atoi function, and I am supposed to pass my variables in after ./a.out. Here is my code: #include <stdio.h> #include <stdlib.h> int myatoi(char array[]) { int sum = 0; int i = 0; while(array[i] != '\0') { int number = array[i] - '0'; … |
The End.