#include <stdio.h>
int main()
{
int a;
int b;
int c;
printf("Welcome to addition!\n");
printf("First Number: ");
Type: Posts; User: heinz55
#include <stdio.h>
int main()
{
int a;
int b;
int c;
printf("Welcome to addition!\n");
printf("First Number: ");
I may have had a moment of weakness when I wrote the first post. And hopefully my "way too modest math abilities" will not jeopardize my coding career.
But the fact is that back in the school I...
Hello.
I have this question: if I must describe myself as "not actually a math guy", do I ever have a chance to become a great coder?
My strong side have always been arts and literature. And...
Thank you for explaining. I had no idea fseek() behaves that way.
Hello,
I have a question related to this code:
#include <stdio.h>
#include <stdlib.h>
Actually your code is pure C not C++.
Anyway, this particular code should not give us any output. So it's quite a mystery how did you get this "0 1 2 0".
What compiler are you using?
Imagine something like this:
int num_list[5] = {1, 5, 77, 3, 35}; // has only 5 elements
cout << num_list[6] << endl; // but 6-th element is also accessible
cout << num_list[-7] << endl;...
Hello,
I have a question about those code snippets below.
Sample A:
for(int i=0; i<getSomeLenght(); i++) {
// Some code here
}
Since char takes only one byte, a[30] reserves exactly 30 bytes.
Try exit(0); not just exit();
Sorry I must've misunderstood you. Do you mean exit the entire program? Or just exit the function?
In void function just write 'return'
void someFunction(void)
{
/* some code here */
return;
}
void hello(const char *message, const char *testMsg="Testing...\n")
Aren't default parameters illegal in 'C'? However, in 'C++' they are perfectly acceptable.
Hello,
I was wondering if there is any connection between programmer's personality type and his/her favourite brace style?
As I have noticed, large amount of coders seem to prefer either K&R or...
Hello,
Can someone explain why "inline if" does not work in this particular example:
#include <iostream>
using namespace std;
string replaceStr(string source, char a, string b)
Could someone explain what is the most correct usage of free() function in this paricular case:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void reverseStr(const char...
I'm just trying to write C code that can be compiled with C++ compilers as well. Simple as that.
But if I write C++ then I try to keep it pure C++.
You are correct, but traditional C does not support the "new" keyword.
Thanks for the advices given so far. I'll try to follow at least most of them.
Just a brief note considering this line:
PERSON *p = (PERSON *)malloc(sizeof(PERSON));
Since I try to make my...
Hello,
I'm trying to understand the logic of recursive structures (or is "linked list" much proper term?) and I have a problem with following code:
#include <stdio.h>
#include <stdlib.h>
...
Hello.
This simple code was nicely working:
#include <stdio.h>
#include <string.h>
int main(void)
{
Yes it really works! All the other tricks I tried caused whether errors or segmentation faults.
Thank you so much.
Here is my simple working program:
#include <stdio.h>
#define CHANGE_STR(old_str, new_str) (old_str = new_str)
int main(void)
{
char *msg = "This is old message.";