-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpp01.cpp
45 lines (41 loc) · 840 Bytes
/
cpp01.cpp
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**********************************************************
* Student No: 12815482 *
* Student Name: Tirthankar Bhaumik *
* Course: MSc Computing for Financial Services *
* Assignment: Final Assignment 4 *
* Objective: Demo of CPPCHECK tool - Various bugs *
**********************************************************/
#include <iostream>
#include <string>
using namespace std;
bool f(int x)
{
int i;
if (x == 0)
{
i = 0;
return false;
}
return true;
}
char* createT()
{ return new char[100]; }
void destroyT(void* p)
{ free(p); }
void s(int x)
{
char* f = createT();
if (x == 1)
return;
destroyT(f);
}
int main()
{
char a[10];
char b[20];
a[10] = 0;
strcpy(a, b, 25);
for (int i=0; i<20; i++)
b[i] = a[i];
return 0;
}