Search:

Type: Posts; User: thmm

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    173

    Also posted here: C Programming Linked List - C...

    Also posted here:
    C Programming Linked List - C And C++ | Dream.In.Code
  2. Thread: Composition

    by thmm
    Replies
    11
    Views
    577

    @laserlight, I just wanted to show an...

    @laserlight,
    I just wanted to show an alternative way to do certain things.
    I don't claim that it is better.
    Not needing inheritance is a just a nice side ffect.
    I guess that not using virtual...
  3. Thread: Composition

    by thmm
    Replies
    11
    Views
    577

    An alternative without virtual functions and...

    An alternative without virtual functions and pointers is to use std::variant and std::visit - since C++17.


    #include <iostream>
    #include <vector>
    #include <variant>


    class Vehicle
    {
  4. Replies
    24
    Views
    1,220

    VS 2019 16.8.4 gives me this warning with /W4:...

    VS 2019 16.8.4 gives me this warning with /W4: warning C4189: 'i': local variable is initialized but not referenced
    You probably need to enable Code Analysis on Build under Code Analysis in the...
  5. Replies
    9
    Views
    666

    That was my idea: #include #include...

    That was my idea:


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


    void repeat(const char* input, char *output)
    {
    int n = 0;
    char buffer[32] = {'\0'};
  6. Thread: Just starting

    by thmm
    Replies
    17
    Views
    811

    I don't think it has anything to do with the...

    I don't think it has anything to do with the language, it has more to do about thinking clearly. Python would be easier to learn because you don't need manual memory management, it also has build-in...
  7. Thread: Just starting

    by thmm
    Replies
    17
    Views
    811

    @john.c why do you mention books about C++ when...

    @john.c
    why do you mention books about C++ when he wants to learn C ?
  8. Replies
    9
    Views
    666

    I rather would do it like this: #ifdef...

    I rather would do it like this:


    #ifdef _MSC_VER
    #define _CRT_SECURE_NO_WARNINGS
    #endif

    #include <stdio.h>
    #include <conio.h>
    #include <string.h>
  9. Thread: arrays

    by thmm
    Replies
    7
    Views
    263

    6356672 was the address of array1. If you want...

    6356672 was the address of array1. If you want the actual number you have to use the subscript operator, like array1[0], array1[1]...
    I would recommend that you get a (e)book. Just guessing how...
  10. Thread: printf int

    by thmm
    Replies
    2
    Views
    226

    You need a format specifier in your printf. ...

    You need a format specifier in your printf.

    printf("1+2= %d", int3);
  11. Thread: Copy function

    by thmm
    Replies
    2
    Views
    292

    You need to copy the values from arr1 to arr2...

    You need to copy the values from arr1 to arr2 only if they are greater than threshold. There is no need to find the min.

    Maybe sth. like this:


    for (int i = 0; i < length; ++i) {
    if...
  12. You are right. Thanks for pointing it out.

    You are right. Thanks for pointing it out.
  13. Wouldn't it be possible to set the locale to a...

    Wouldn't it be possible to set the locale to a country that uses the comma as decimal separator and read the input as a flaot ?
  14. Replies
    8
    Views
    495

    When I ran the code in VS 2019 I got an exception...

    When I ran the code in VS 2019 I got an exception at line 85

    strcpy(A[index].name, temp.name);
    when index was -307.
  15. Thread: I've been stuck.

    by thmm
    Replies
    6
    Views
    652

    Have a look at this tutorial. It uses an int for...

    Have a look at this tutorial. It uses an int for the data but you could modify to use strings.
    Given a linked list which is sorted, how will you insert in sorted way - GeeksforGeeks
  16. Replies
    5
    Views
    530

    Why not follow the KISS priciple? #define...

    Why not follow the KISS priciple?



    #define NAME_LEN 100
    char first_name[NAME_LEN];
    scanf("%99s", first_name);
  17. Replies
    9
    Views
    728

    Consider sth. like this: bool import(bool...

    Consider sth. like this:


    bool import(bool provided)
    {
    char file_name[256] = { 0 };
    FILE* src = NULL;


    if (provided)
  18. Replies
    8
    Views
    567

    Not sure if you have learned about functions yet,...

    Not sure if you have learned about functions yet, but they would make your task easier:


    #include <stdio.h>
    #include <stdbool.h>


    void print_prime_factors(int num)
    {
    printf("The prime...
  19. Replies
    213
    Views
    11,836

    Still no luck with MinGW:...

    Still no luck with MinGW:
    Alu_demo\alu\_.h|4|fatal error: unic/limits.h: No such file or directory|
  20. Replies
    213
    Views
    11,836

    It has nothing to do with MS. Neither MinGW nor...

    It has nothing to do with MS. Neither MinGW nor cygwin have these
  21. Replies
    213
    Views
    11,836

    Is it really necessary to use non-standard...

    Is it really necessary to use non-standard headers like uchar.h and non-standard types like ssize_t ?
  22. Replies
    213
    Views
    11,836

    5. People might had an interest but couldn't...

    5. People might had an interest but couldn't build it Windows(possible)
  23. If you want to do some automated testing - and at...

    If you want to do some automated testing - and at some point you need to learn it - you follow this pattern:
    1. define your input
    2. define the expected output
    3. get the actual output
    4. check...
  24. Replies
    6
    Views
    636

    Wheb hamster_nz spoke about heaps he porbbly...

    Wheb hamster_nz spoke about heaps he porbbly meant the data structure, not the place where malloc allocates the memory.
    Heap Data Structure - GeeksforGeeks

    I am not sure if a text file is the...
  25. Thread: Dice

    by thmm
    Replies
    12
    Views
    832

    Maybe like this: #include #include...

    Maybe like this:

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


    int roll()
    {
    int dice;
Results 1 to 25 of 51
Page 1 of 3 1 2 3