Q, I could be a real dick and say ask your local college for a refund, but a demo from my computer is enough.
$emacs -nw sumit.c
$gcc -Wall sumit.c -o sumit
sumit.c:4: warning: return type...
Type: Posts; User: cdalten
Q, I could be a real dick and say ask your local college for a refund, but a demo from my computer is enough.
$emacs -nw sumit.c
$gcc -Wall sumit.c -o sumit
sumit.c:4: warning: return type...
And how do you propose we handle situations were a person wants to sum up say like:
12 and 15? Your solution breaks down.
I was looking to redeem myself for overcomplication the factorial problem on a previous thread.....
Nah....I won't post another solution.
Calm down.
Hmmm..... I wasn't aware you could do that. You win. Pull my finger.
Hmm.... my C coding probably blows, but here is what went through my snoodle.
#include <stdio.h>
#include <stdlib.h>
#define BUFF 30
int main (void) {
On some unnamed operating systems, it's not possible to malloc() more than 2GB of memory. It has something to do with how the userland and kernelland space is divided up in virtual memory. I think...
And for some reason, the edit post thingy option doesn't appear to be working on my account -(.
Here is some more comments on your code.
typedef struct prod_record {
int prod_no;
char prod_name[50];
float price, stock_on_hand;
}elementtype;
On the link for using strcspn Part 1, I didnt think the following line was legal c code
printf("line %d:\n", ++k);
Maybe I mis-understood the concept of a sequence point from the c faq....
I don't think it is possible to write a portable program that lists the hard drive. Say you have a hard drive and a cd-rom. On windows, the hard drive might be listed as the c drive and the cd-rom...
When the function permute() calls itself recursively, it hits permute() first. I guess the thing that is/was throwing me is that rotate() doesn't get execute right after the permute() function. Or at...
Given the following program that calculate all the permutations on a string
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void rotate(unsigned length, char *string)
{
Should I really start confusing the OP about linux shells now? Technically a shell on linux forms a session. The standard output, input, and error from the shell are connected to either a terminal or...
Doesn't using non-standard headers defeat the whole purpose of writing portable C code (which made C famous in the first place)?
The C programming language doesn't have threads. This is an operating system specific issue. In this case, you might want to consider getting a hold of the book "Advanced Programming in the Unix...
I thought that was only if the 'static' keyword was present.
On one end, was my linux box running ssh. On the other end, I was trying to connect to it using my laptop (via a 'borrowed' wireless connection). I just entered my name, not any of the others show in...
I recently decided to install scanlogd on linux because of the massive number of portscans I seem to get when I connect to the IRC. Anyhow, I installed the the program right of the suse linux cd. I...
I take it you've tried to return a multidimensional array at one point and time while learning c?
Here is the buggy c code
include <stdio.h>
#include <stdlib.h>
#define MAX 8
int main(void) {
Running the code with full warnings produced nothing.
$gcc -Wall str.c -o str
$./str
Hello, world!
Running efence(3) with the default arguments produced the following:
$gcc -Wall str.c -o...
I have a question regarding the following code
/*I omitted checking malloc() for NULL and didnt use free();
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
Yes, memory alignment in C structures still matter. There are various (non-portable) ways to ensure the alignment of the variables in memory will be aligned from one machine to the next. Some methods...
Dave,
Yes, that smells like what the good professor was talking about at the time. Okay, since it is starting to become apparent that I make a fool out of myself in front of the smart people,...
Portability is just a passing fad.