Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
C
cwe_checker
  • Overview
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • fact-gitdep
  • cwe_checker
  • Repository

Switch branch/tag
  • cwe_checker
  • test
  • unit
  • testfiles
  • arrays.c
Find file
BlameHistoryPermalink
  • Melvin Klimke's avatar
    Unittest flexibility (#67) · 111ab158
    Each unit test can now be run with a separate test binary, making all unit tests more flexible.
    Melvin Klimke authored 4 years ago
    111ab158
arrays.c 426 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include <stdio.h>
#include <stdlib.h>

void heap_based_array(){
        char* a = malloc(20);

        for(int i=0; i<20;i++){
                *(a + i) = 'A';
        }

        free(a);
}

void stack_based_array(){
        char a[20];
        for(int i=0; i<20;i++){
                a[i] = 'A';
        }
}

int main(int argc, char *argv[argc])
{
        stack_based_array();
        heap_based_array();
        return 0;
}
×

Replace arrays.c

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.