# Search:

Type: Posts; User: Structure

Page 1 of 14 1

1. ## Thread: I cant understand the output

by Structure
Replies
6
Views
363

### int x = 1; printf( "%d %d %d\n", ++x, x, x++...

int x = 1; printf( "%d %d %d\n", ++x, x, x++ );"there is absolutely no guarantee that this order would be used in any other environment, in the same environment with different options selected, or...
2. ## Thread: Making a teapot using triangles

by Structure
Replies
8
Views
476

### Utah teapot - Wikipedia...

Utah teapot - Wikipedia
Graphics pipeline - Wikipedia
Polygon mesh - Wikipedia
3. ## Thread: Checking if the input is a character ?

by Structure
Replies
16
Views
607

### This one includes integer fractions ... ...

This one includes integer fractions ...

int isNumber( char *string ) {
int oneDot = 0, stringLength = strlen(string), ii;
for (int i=0; i<stringLength; i++) {
ii =...
4. ## Thread: Checking if the input is a character ?

by Structure
Replies
16
Views
607

### preemptive fix... int isNumber( char...

preemptive fix...

int isNumber( char *string ) {
int oneDot = 0;
for (int i=0; i<strlen(string); i++) {
if ( (int)string[i] >= 48 && (int)string[i] <= 57 ) {
//...
5. ## Thread: Checking if the input is a character ?

by Structure
Replies
16
Views
607

### int isNumber( char *string ) { int oneDot =...

int isNumber( char *string ) {
int oneDot = 0;
for (int i=0; i<strlen(string); i++) {
if ( (int)string[i] >= 48 && (int)string[i] <= 57 ) {
// valid digit ;
}...
6. ## Thread: Checking if the input is a character ?

by Structure
Replies
16
Views
607

### int isNumber( char *string ) { int oneDot =...

int isNumber( char *string ) {
int oneDot = 0;
for (int i=0; i<strlen(string); i++) {
if ( (int)string[i] >= 48 && (int)string[i] <= 57 ) {
// valid digit ;
}...
7. ## Thread: Checking if the input is a character ?

by Structure
Replies
16
Views
607

### #include #include int...

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

int isNumber( char *string ) {
for (int i=0; i<strlen(string); i++) {
if ( (int)string[i] >= 48 && (int)string[i] <= 57 ) {
//...
8. ## Thread: Matrix behaviour: assignment to scalar

by Structure
Replies
6
Views
518

### multiply the identity matrix by the scalar. ...

multiply the identity matrix by the scalar.

"The term scalar multiplication refers to the product of a real number and a matrix. In scalar multiplication, each entry in the matrix is multiplied by...

by Structure
Replies
1
Views
207

### this might help... #include ...

this might help...

#include <stdio.h>

void primoultimopari(char list[], int dimensione, int *prima, int *ultima) {
*prima = -1;
*ultima = -1;
for (int i=0; i<dimensione;...
10. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### I can understand this, but why include an entire...

I can understand this, but why include an entire library for one function?
Although i used strlen, i'm saying it could be useful sometimes to create the one function you need.

by Structure
Replies
30
Views
678

16198

16199
12. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### considering what this code does, this is...

considering what this code does, this is disturbing.

16197
13. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### also i believe when you do this: ...

also i believe when you do this:

packetBuffer[len] = 0;
you actually want do do this:

packetBuffer[len-1] = 0;
also, you are going to want to zero terminate both strings.
14. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### printf( "[%s]", packetBuffer ); if you don't...

printf( "[%s]", packetBuffer );

if you don't see [101_idle] but you see [101_idle(+ some other bs)] ;

that could be your comparison problem.
15. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### Where you commented out the comparison, print out...

Where you commented out the comparison, print out the buffer to the console to see what it actually recieves.
16. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### I'm looking at your code... go back to what...

go back to what you had i have a better idea of what you are trying to do.
17. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### #include #include const...

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

const char *isAvailable = "_available";
const char *notAvailable = "_disabled";

char tables[10][32];

void enableTable( int table ) {
strcpy(...
18. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### ok, this is what i would do... compile this as a...

ok, this is what i would do... compile this as a seperate program and take a look at it... give me a min.
19. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### add this as a function above main() int...

add this as a function above main()

int compare( char *string1, char *string2 ) {

if ( strlen(string1) != strlen(string2) ) {
return 2;
}
20. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### it's expecting a char and you are trying to set...

it's expecting a char and you are trying to set it to a string of chars.
That's why i added the pointer *.

char *situationOne = "_available";

same for the function, change char to char *

...

by Structure
Replies
30
Views
678

:confused:
22. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### you could also return 2 if they are are not the...

you could also return 2 if they are are not the same length.
This way you can find out if you have trailing bytes at the end or beginning.

int compare( char *string1, char *string2 ) {
...
23. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### #include #include char...

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

char *string = "string one";
char *other = "string one";

int compare( char *string1, char *string2 ) {
if ( strlen(string1) != strlen(string2)...
24. ## Thread: How to verify my incoming UDP packet correctly?

by Structure
Replies
30
Views
678

### maybe try a byte to byte comparison ? i.e:...

maybe try a byte to byte comparison ?

i.e: instead of using strcmp(), compare:
for (x++) { if string[x] == other[x] }
25. ## Thread: Program using Stack

by Structure
Replies
5
Views
408

### #include #include char...

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

char *testText = "word flip function";

void flipPrint(char *text) {
int sLength = strlen(text);
int this = 0, last = -1;
for (int i = 0; i...
Results 1 to 25 of 342
Page 1 of 14 1