# Search:

Type: Posts; User: Salem

Page 1 of 20 1

1. ## Thread: finding average of even numbers at first occurence of odd input

by Salem
Replies
6
Views
85

### Well sum/2 isn't going to give you an average,...

Well sum/2 isn't going to give you an average, unless you only type in two numbers.
2. ## Thread: finding average of even numbers at first occurence of odd input

by Salem
Replies
6
Views
85

### Lines 15 and 16 should be inside your loop. >...

Lines 15 and 16 should be inside your loop.

> avg=sum/cou;
Beware of integer division.

- make some other variables floats to begin with.
- cast one of them to a float before dividing.
3. ## Thread: arrays

by Salem
Replies
7
Views
82

### > so how would I printf a house? One at a...

> so how would I printf a house?
One at a time.

There is one exception...

char sentence[] = "The cat sat on the mat";
printf("%s\n", sentence);

A char array (and ONLY a char array) can...
4. ## Thread: Passing array size as a const variable do not compile

by Salem
Replies
5
Views
83

### Dunno. Maybe your first example would work if...

Dunno.

Maybe your first example would work if the size was also static.

Or maybe your compiler is feeling generous.
5. ## Thread: arrays

by Salem
Replies
7
Views
82

### array = a street. array[0] = a house on that...

array = a street.
array[0] = a house on that street.
array[1] = the house next door.

You use arrays when you have to store multiple things of the same type.
6. ## Thread: Passing array size as a const variable do not compile

by Salem
Replies
5
Views
83

### Because constants in C are not the same as...

Because constants in C are not the same as constants in C++.

In C, const just means "I pinky-promise that I'm not going to try and modify this memory".

You have to use the #define route as...
7. ## Thread: Help me debug some part in my program

by Salem
Replies
1
Views
91

### Well the nicely formatted code here...

Well the nicely formatted code here has been turned back into dog food.

> the program will keep on print CONTACT RECORD IS NOT FOUND multiple times until the contact list arrangement is same to...
8. ## Thread: Segmentation fault on strcpy to structure member

by Salem
Replies
1
Views
75

### Works for me. #include...

Works for me.

#include<stdio.h>
#include<string.h>

#define MESSAGE_MAX_LENGTH 100
#define MESSAGE_ID_MAXLEN 10
#define MSG_DELIMITER ","
9. ## Thread: How to sort data in .txt file

by Salem
Replies
3
Views
185

### Well that was nothing like I expected. ...

Well that was nothing like I expected.

#include<stdio.h>
#include<string.h>

int main ( ) {
const char *seps = " \n";
FILE *in = fopen("foo.txt","r");
char buff[BUFSIZ];
10. ## Thread: How to find all calls to a method of some class which has common name

by Salem
Replies
10
Views
304

### Which hardware device? If you're fortunate...

Which hardware device?

If you're fortunate enough, maybe your CPU has hardware breakpoint or trace registers.

If so, you could implement a local handler to increment a local counter that...
11. ## Thread: how to create and save more than 10^18 Integer Data Type?

by Salem
Replies
2
Views
168

### The GNU MP Bignum Library (https://gmplib.org/)

The GNU MP Bignum Library
12. ## Thread: help on debugging my code please

by Salem
Replies
3
Views
183

### 1. Your indentation needs work. ...

1. Your indentation needs work.

#include<stdio.h>
//!!#include<conio.h>
#include<string.h>
#include<stdlib.h>
//!!#include<windows.h>

struct person {
13. ## Thread: return function pointer getting crushed??

by Salem
Replies
8
Views
224

### Oh but there is. Just having an interrupt...

Oh but there is.

Just having an interrupt happen will trash the contents of the very stack currently balanced on a knife edge of calamity.
14. ## Thread: Help with funcions

by Salem
Replies
1
Views
148

### Also here -> Help With Functions - C And C++ |...

Also here -> Help With Functions - C And C++ | Dream.In.Code
15. ## Thread: Need help with debugging this code

by Salem
Replies
1
Views
161

### Here's a list of things to do. 1. remove dos.h...

Here's a list of things to do.
1. remove dos.h
2. remove conio.h
3. remove process.h
All of those are obsolete.

4. remove gets(), the world's most dangerous function.
It's been removed from...
16. ## Thread: Why wont this simple calculator program using the switch function work?

by Salem
Replies
2
Views
167

### > scanf("%f %c % f", &value1, &operator,...

> scanf("%f %c % f", &value1, &operator, &value2);
There is a space between "%" and "f" which should not be there.

> I'm using Codeblocks.
Go into project settings and put -Wall -Wextra on the...
17. ## Thread: How this snprintf function works?

by Salem
Replies
7
Views
182

### It's basically telling you how much space you...

It's basically telling you how much space you have left in your buffer.

> snprintf(&data_tx[index], sizeof(data_tx) - index
Every time you increment index, the place you write to advances, and...
18. ## Thread: return function pointer getting crushed??

by Salem
Replies
8
Views
224

### > I do believe it is safe as I immediately act on...

> I do believe it is safe as I immediately act on the results and use them before the function gets called again
Well....

> This is all occurring on an embedded processor with a well defined...
19. ## Thread: How to code login function using UDF in C language

by Salem
Replies
10
Views
305

### Whatever. Post your code and we'll tell you...

Whatever.

Post your code and we'll tell you whether it's right or not.
20. ## Thread: return function pointer getting crushed??

by Salem
Replies
8
Views
224

### This NEVER works, can never work. int *foo (...

This NEVER works, can never work.

int *foo ( ) {
int array[10];
// do stuff
return array;
}

by Salem
Replies
10
Views
305

What's UDF?
22. ## Thread: How to find all calls to a method of some class which has common name

by Salem
Replies
10
Views
304

### If you're looking for run-time, you need some...

If you're looking for run-time, you need some kind of profiling tool.
Gprof - Wikipedia
23. ## Thread: How this snprintf function works?

by Salem
Replies
7
Views
182

### Sorry, it looks like I got the source and...

Sorry, it looks like I got the source and destination arrays mixed up. I thought you were trying to fit 16 somethings into 3 somethings.

#include<stdio.h>
#include<stdlib.h>...
24. ## Thread: How this snprintf function works?

by Salem
Replies
7
Views
182

### > uint8_t payload = 3; > uint16_t...

> uint8_t payload = 3;
> uint16_t raw_data[payload];
..
> index += snprintf(&data_tx[index], 5 , "%d", raw_data[i]);
std::printf, std::fprintf, std::sprintf, std::snprintf - cppreference.com...
25. ## Thread: Stop a while/for loop when the user inputs a string

by Salem
Replies
1
Views
159

### if ( strcmp(input,"apple") == 0 )

if ( strcmp(input,"apple") == 0 )
Results 1 to 25 of 500
Page 1 of 20 1