You have a bug in your program. It's hard to guess what it is without seeing the code? In some cases compilers are allowed to do different things with the same code. What are the types of string1 and string2 Answer from jedwardsol on reddit.com
๐ŸŒ
OnlineGDB
question.onlinegdb.com โ€บ 16297 โ€บ how-to-read-from-a-file-txt-in-c-online-gdb
How to read from a file(txt) in c++ online GDB? - OnlineGDB Q&A
June 24, 2024 - Hi, so I am confused as to how to connect and use files(txt) that I have saved to my folder. I ... its output to a second file. How do I do that?
๐ŸŒ
OnlineGDB
onlinegdb.com โ€บ fork โ€บ S13OWDh3b
GDB online Debugger | Code, Compile, Run, Debug online C, C++
/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ /* OF LOOPS, PARENTHESES AND CONDITIONS!
Discussions

Why is onlineGDB not giving the same result as another compiler?
Thank you for your contribution to the C++ community! As you're asking a question or seeking homework help, we would like to remind you of Rule 3 - Good Faith Help Requests & Homework. When posting a question or homework help request, you must explain your good faith efforts to resolve the problem or complete the assignment on your own. Low-effort questions will be removed. Members of this subreddit are happy to help give you a nudge in the right direction. However, we will not do your homework for you, make apps for you, etc. Homework help posts must be flaired with Homework. ~ CPlusPlus Moderation Team I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
๐ŸŒ r/Cplusplus
8
1
May 4, 2024
Online GDB doesn't work as expected?
Through some checking on godbolt , it appears OP is using a GCC with version 6.3 or older. What you are essentially asking is, why does GCC, at a given version, decide to reserve 48-bytes on the stack for what appears to only be 32-bytes worth of data (using 8 bytes for the int). My answer: I don't know. Could be a bug, could be bad optimization, could be oversight, could be for some other reason or no reason at all. Using GCC version 7.1 or newer results in the function reserving 32-bytes on the stack as you would expect. More on reddit.com
๐ŸŒ r/C_Programming
4
2
December 2, 2021
Can anyone recommend an online C compiler that allows #include "myheader.h"?
Online C compiler? Really? Why would you want something like this? More on reddit.com
๐ŸŒ r/C_Programming
39
0
June 12, 2019
Any good and easy-to-use C debuggers?
On linux, there is gdb, there are also some online variants if you are into that, also valgrind for memory related issues on windows, Visual studio has integrated debugger. Also Dr.Memory for memory related issues, I believe there are versions for win, linux & mac. More on reddit.com
๐ŸŒ r/C_Programming
28
21
January 12, 2023
๐ŸŒ
OnlineGDB
onlinegdb.com โ€บ online_objectivec_compiler
Online Objective-C Compiler - online editor
/****************************************************************************** Online Objective-C Compiler. Code, Compile, Run and Debug Objective-C program online. Write your code in this editor and press "Run" button to execute it.
๐ŸŒ
YouTube
youtube.com โ€บ coders station
How to run C program in online compiler (gdb compiler)| Online gdb C compiler - YouTube
How to run C program in online compiler (gdb compiler)| Online gdb C compilerIf you are interested to discover more about How to run C program in online comp...
Published ย  July 3, 2023
Views ย  406
๐ŸŒ
Reddit
reddit.com โ€บ r/c_programming โ€บ online gdb doesn't work as expected?
r/C_Programming on Reddit: Online GDB doesn't work as expected?
December 2, 2021 -

I am posting this both on r/Assembly_Language and here. I think the topic involves both fairly strongly.

So, I am going to do a presentation involving buffer overflows and I learned some basic Assembly because of that (more specifically the function prologue). I plan on learning Assembly for real and have installed SASM, but for now I just know basic C. I need help reading something.

In one of my sources (https://www.tenouk.com/Bufferoverflowc/Bufferoverflow4.html), this guy does disass in his vulnerable function in order to show that sub has allocated more space than he declared (4 vs 20).

This is his code:

#include <unistd.h>

 

void Test()

{

   char buff[4];

   printf("Some input: ");

   gets(buff);

   puts(buff);

}

 

int main(int argc, char *argv[ ])

{

   Test();

   return 0;

}

And this is the output of disass Test:

0x080483d0 <Test+0>:    push   %ebp

0x080483d1 <Test+1>:    mov    %esp, %ebp

0x080483d3 <Test+3>:    sub    $0x8, %esp

0x080483d6 <Test+6>:    sub    $0xc, %esp

Buff is 4 bytes and 20 bytes are "freed" on the stack. But when I try to do the same with a relatively more complicated function (I hope commentary is enough for the language gap):

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

void senha(){      
 char senha[10];           
    char senhareal[10]="dddddd";      
    int teste = 0;    
    char resposta[3]; 
    
    printf("\n\n\n\n-----------------------------SISTEMA NUCLEAR DA OTAN------------------------------------ \n\n\n\n");     
    
    
    printf("DIGITE SUA SENHA: ");
    gets(senha);


    if(0 == strncmp(senha, senhareal, 20))
    {
         printf ("\nSenha correta! \n");
         teste = 1;    
    }
    
    
    else
    {
        printf ("\nSENHA INCORRETA! \n");
    }


    if(teste)
    {
        printf ("\nO usuรกrio agora controla a instalaรงรฃo! Deseja destruir o Brasil? \n");     
        gets(resposta); 
    }
            }

int main(){               
    system("color 03");
	setlocale(LC_ALL, "Portuguese"); 
    senha();  

    return 0;
}

I get this:

0x0000555555555209 <+0>: endbr64
0x000055555555520d <+4>: push %rbp
0x000055555555520e <+5>: mov %rsp,%rbp
0x0000555555555211 <+8>: sub $0x30,%rsp
0x0000555555555215 <+12>: mov %fs:0x28,%rax
0x000055555555521e <+21>: mov %rax,-0x8(%rbp)

No matter my input. So why does Online GDB consistently subtract 48 bytes? What are the instructions following sub and do they apply at all to what I am trying to do? Is it possible to know what's going on in that specific platform? Finally, am I unable to replicate what this person did with my code?

I tested the code of my source in Online GDB as well. It consistently subtracts 16 bytes.

Find elsewhere
๐ŸŒ
OnlineGDB
question.onlinegdb.com โ€บ 12355 โ€บ how-much-bit-compiler-is-used-for-c-and-c-by-onlinegdb-tool
how much bit compiler is used for c and c++ by onlinegdb tool? - OnlineGDB Q&A
May 11, 2022 - Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
๐ŸŒ
OnlineGDB
onlinegdb.com
GDB online Debugger | Compiler - Code, Compile, Run, Debug online C, C++
Online GDB is online compiler and debugger for C/C++. You can compile, run and debug code with gdb online. Using gcc/g++ as compiler and gdb as debugger. Currently C and C++ languages are supported.
๐ŸŒ
OnlineGDB
onlinegdb.com โ€บ online_c_compiler
Online C Compiler - online editor
OnlineGDB is online IDE with c compiler. Quick and easy way to compile c program online. It supports gcc compiler for c.
๐ŸŒ
Programiz
programiz.com โ€บ c-programming โ€บ online-compiler
Online C Compiler - Programiz
3 weeks ago - Write and run your C programming code using our online compiler. Enjoy additional features like code sharing, dark mode, and support for multiple languages.
๐ŸŒ
JDoodle
jdoodle.com โ€บ c-online-compiler
Online Compiler and Editor/IDE for Java, C, C++, PHP, Python, Ruby, Perl - Code and Run Online
JDoodle is an Online Compiler, Editor, IDE for Java, C, C++, PHP, Perl, Python, Ruby and many more. You can run your programs on the fly online, and you can save and share them with others. Quick and Easy way to compile and run programs online.
๐ŸŒ
OneCompiler
onecompiler.com โ€บ c
C Online Compiler
OneCompiler's C Language editor helps you to write, compile, debug and run C code online. It's powered by GCC compiler
๐ŸŒ
CodeChef
codechef.com โ€บ c-online-compiler
Online C Compiler
Welcome to our AI-powered online C compiler, the perfect platform to run and test your C code efficiently. Our tool makes coding easy for developers of any skill level, whether you're a beginner or experienced.
๐ŸŒ
Compiler Explorer
godbolt.org
Compiler Explorer
Compiler Explorer is an interactive online compiler which shows the assembly output of compiled C++, Rust, Go (and many more) code.
๐ŸŒ
Reddit
reddit.com โ€บ r/c_programming โ€บ can anyone recommend an online c compiler that allows #include "myheader.h"?
r/C_Programming on Reddit: Can anyone recommend an online C compiler that allows #include "myheader.h"?
June 12, 2019 - Because allowing this makes the design of the tool much more complicated and in all cases where you just want to do a quick test, you can copy the content of the file to be included into the file instead of using an include directive. more replies More replies More replies More replies More replies ... I still maintain that an online compiler is not a good environment to learn C programming in.
๐ŸŒ
OnlineGDB
question.onlinegdb.com โ€บ 16030 โ€บ compiling-multiple-c-files
Compiling multiple C files - OnlineGDB Q&A
Hi! I'm wondering if it possible to compile a two (or more) source files creating the corresponding object files on OnlineGDB... in case how?