Search:

Type: Posts; User: talahin

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. My compiler says: gcc -Wextra -Wall...

    My compiler says:


    gcc -Wextra -Wall -pedantic -std=c99 -o monsters monsters.c
    monsters.c: In function ‘main’:
    monsters.c:11:19: warning: assignment makes pointer from integer without a cast...
  2. Replies
    5
    Views
    671

    Hi, You should lookup integer divisions. Also...

    Hi,
    You should lookup integer divisions.
    Also you're still missing some semicolons.

    Cheers
  3. If you want the rightmost occurrence, maybe...

    If you want the rightmost occurrence, maybe searching from they right would be easier.

    for (i = strlen(s); i >= 0: i--) {
    if ( strstr( s + i, t ) != NULL ) { // found it
    return i;
    ...
  4. Thread: Help (Matrix)

    by talahin
    Replies
    3
    Views
    638

    Does this even compile? Try to read A...

    Does this even compile?
    Try to read A development process
    And then try to build your program up slowly adding one function at a time.
    So start with a program that has 2 functions. One that fills...
  5. Thread: Grocerylist

    by talahin
    Replies
    2
    Views
    729

    Take a good look at line 7 (the strcpy). Is this...

    Take a good look at line 7 (the strcpy). Is this really what you want to do?
    Also try to increase the warning level of your compiler.

    Cheers
  6. Replies
    2
    Views
    800

    Maybe you could read the wikipedia artikel...

    Maybe you could read the wikipedia artikel about it.

    Cheers
  7. Replies
    5
    Views
    1,103

    Maybe you should reread your documentation on...

    Maybe you should reread your documentation on strcpy_s. Especialy the amount of parameters it uses and its return value.

    Cheers
  8. Replies
    4
    Views
    4,132

    Just paste your code between code tags ...

    Just paste your code between code tags



    #define _CRT_SECURE_NO_WARNINGS
    #include<stdio.h>
    #include<math.h>
    #include <stdlib.h>
    #include<time.h>
  9. Replies
    7
    Views
    983

    Try looking up the srand() function. Cheers

    Try looking up the srand() function.

    Cheers
  10. Maybe you should close your output file after you...

    Maybe you should close your output file after you wrote all your data.

    Thanks for using code tags, but please use a consistent indentation, your code is still hard to read.

    And finally take a...
  11. Thread: Incrementing

    by talahin
    Replies
    3
    Views
    874

    Why do you think it should be [1 1]. Remember...

    Why do you think it should be [1 1].

    Remember the x in void f(int x) is a local variable and has no meaning outside the function.

    if you want to return a value you can declare the function as...
  12. Hi, your second problem lies in this part. ...

    Hi,
    your second problem lies in this part.


    for (i=0; i<size; i++){
    if ((strcmp(sur,a[i].epwnymo)) && strcmp(name,a[i].onoma) ){
    x = true;
    break;
    }
    else{
  13. Replies
    2
    Views
    1,376

    Maybe you should include stdio.h, because that is...

    Maybe you should include stdio.h, because that is where printf normally is defined.

    Cheers
  14. If this code compiled without errors, you really...

    If this code compiled without errors, you really need to increase the warning level of your compiler. Just skimming the code, your menu function contains at least 2 mistakes your compiler should warn...
  15. Replies
    14
    Views
    7,020

    So, you allocate a datablock and assign it to a...

    So, you allocate a datablock and assign it to a variable that will get lost when the function returns. Also you don't check if the memory really got allocated in the first place.

    Cheers.
  16. Replies
    9
    Views
    656

    Hi Check line 49 for(i=0;i

    Hi

    Check line 49 for(i=0;i<2;j++)


    Edit: Nominal Animal was the faster one. :)

    Cheers
  17. Hi, First it's not the "?" operator, but "? :"...

    Hi,

    First it's not the "?" operator, but "? :" operator. It's a ternary operator, meaning it needs 3 operands.
    As you noticed, leaving out one of the operands will make the compiler complain.
    ...
  18. Hi, Try if (state != digitalRead(PinBtn))...

    Hi,
    Try


    if (state != digitalRead(PinBtn)) {
    state = digitalRead(PinBtn) , TurnLed(state) ;
    }


    Also you're reading the button 3 times in your loop. What happens if the button is...
  19. Hi, The second and third operand of a ? :...

    Hi,
    The second and third operand of a ? : operator need to have the same type. Because there is no second operand the compiler can't deduce the type of the operand.
    Try to rewrite the statement as...
  20. Replies
    12
    Views
    4,178

    Why are you generating a new list of random...

    Why are you generating a new list of random numbers in every function call?


    void print_random_numbers(int random_numbers[], size_t n){

    generate_random_numbers(random_numbers);
  21. Replies
    8
    Views
    4,921

    Hi, as to add to whiteflags comment. Original...

    Hi,

    as to add to whiteflags comment. Original malloc would return (char *) and casting was needed. If I recall correctly C99 redefined the return from malloc as (void *) and casting is no longer...
  22. Thread: Happy Numbers

    by talahin
    Replies
    5
    Views
    9,917

    Hi, for(i=1;sum[i]>0;i++){ ...

    Hi,


    for(i=1;sum[i]>0;i++){

    printf("%i--",sum[j]);

    }

    You're printing sum[ j ], but j isn't initialized anywhere in your code and neither is is it modified anywhere.
  23. Replies
    2
    Views
    808

    I would think cranking up the warning level of...

    I would think cranking up the warning level of the compiler would be the first thing to do. The compiler should at least generate a warning when trying to return without a value in a function that...
  24. Replies
    6
    Views
    1,008

    To late with my answer again, but still here's my...

    To late with my answer again, but still here's my response



    #include <stdlib.h>
    #include <stdio.h>

    int main(int argc, char *argv[]) {
  25. Replies
    6
    Views
    879

    Hi, char *p = sp->arrayString[i]; ...

    Hi,





    char *p = sp->arrayString[i];

    You are declaring a pointer to a char, but you don't reserve space for the data p is pointing to. This means p is pointing to a random location. Then...
Results 1 to 25 of 51
Page 1 of 3 1 2 3