language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
/**
* main - Use a while loop to print the alphabet in lower case then upper
* Return: Alphabet in lower and upper. Otherwise 0
*/
int main(void)
{
char c = 'a';
char x = 'A';
while (c <= 'z')
{
putchar(c);
c++;
}
while (x <= 'Z')
{
putchar(x);
x++;
}
putchar('\n');
return (0);
}
|
C |
#define corto_lang_LIB
#include "corto.h"
#include "corto_arg.h"
#include "stdlib.h"
#include "string.h"
typedef struct corto_arg {
char* arg;
corto_argCallback callback;
unsigned int min;
unsigned int max;
corto_ll exclusive;
corto_ll depend;
}corto_arg;
static corto_ll corto_argList = 0;
... |
C | #include <unistd.h>
#include <stdlib.h>
#include "utils.h"
#include "datafile.h"
int main(int argc, char **argv)
{
char *filename = NULL;
datafile_str *file = NULL;
parse_args(argc, argv,
"%s", &filename,
NULL);
if(filename)
file = datafile_create(filename)... |
C | #include <time.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
typedef struct dormitory {
char dormID[10]; /*dormitory ID*/
char StudentID[10]; /*student ID*/
char Name[10]; /*student name*/
char Date[15]; /*check in ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* map.c :+: :+: :+: ... |
C | #include "../../common/common.h"
int main()
{
int Listenfd,connfd,ret;
socklen_t clilen;
struct sockaddr_in cliaddr, servaddr;
char readbuf[TRANSSIZE];
int qlen = 5;
Listenfd = Socket(AF_INET,SOCK_STREAM,0);
memset(&servaddr,0,sizeof(servaddr));
servaddr.sin_family = AF_INET;
serv... |
C | #include <string.h>
#ifndef bool
#define bool int
#endif
#define MAXLEN 100
static char occupy[MAXLEN][MAXLEN];
static int do_exist(char **board, int row, int col, int r, int c, char *word)
{
if (!*word)
return(1);
if (r < 0 || r >= row || c < 0 || c >= col)
return(0);
if (board[r][c] != *word)
return(0);... |
C | /*
* Project: prodcom
* File: queue_functions.c
* All Files: main.c, queue_functions.c, action.c, queue_functions.h,
* queue_struct.h, action.h
* Authors: Tejvir Mann and Ryann Mahajan
* Class: CS 537 OS
* About this file:
* This is file responsible for implementing queue functions such as enqueue, dequeue
*... |
C | /*
** EPITECH PROJECT, 2018
** engine_speed.c
** File description:
** Speed
*/
#include "stek.h"
int manage_speed(void)
{
char *line = NULL;
char **data = NULL;
double speed;
my_put_str(GET_INFO_COMMAND);
line = read_line();
if (line == NULL)
return (2);
finished(line);
line = prepare_str(line);
data = my... |
C | #include <cassert>
#include <immintrin.h>
// reads 0 <= d < 4 floats as __m128
static inline __m128 masked_read (int d, const float *x)
{
assert (0 <= d && d < 4);
__attribute__((__aligned__(16))) float buf[4] = {0, 0, 0, 0};
switch (d) {
case 3:
buf[2] = x[2];
case 2:
buf[1] = ... |
C | // TODO: detect disconnections
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main(int argc, char **argv) {
int port_no = atoi(argv[1]);
int sfd = socket(AF_INET6, SOCK_STREAM, 0);
// networking setup
struct sockaddr_in6 serv_addr;
memset... |
C | #include <stdio.h>
main() {
int c = getchar();
int isNum = c != EOF;
printf("%d", isNum);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char *ptr;
char word[10];
int i, vowcnt=0;
printf("\nEnter a word: ");
scanf("%s",word);
ptr=word;
for(i=0;i<strlen... |
C | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Scheduler.c ... |
C | void main()
{
int n,m=0,i,a[10];
scanf("%d",&n);
do
{
a[m]=n%10;
n/=10;
m++;
}while(n>0);
for(i=0;i<m;i++)
{
printf("%d",a[i]);
}
printf("\n");
} |
C | #include "pipeline.h"
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
static unsigned char *programMemory;
static size_t programMemorySize;
static int64_t registers[NUM_REGISTERS];
static const char ... |
C | precision highp float;
varying vec2 v_texcoord;
uniform sampler2D u_texture;
uniform vec2 pixelSize;
uniform float lowThreshold;
uniform float highThreshold;
uniform bool L2gradient;
#define PI 3.1415926535897932384626433832795
/**
* Applies Sobel kernel to coordinate
* returns x and y gradient
*/
vec2 sobel(vec... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int n, m, i, j;
int k = 0;
int **a;
if (scanf("%d%d", &n, &m) == EOF)
return 0;
a = (int**) malloc(sizeof (int*) * n);
for (i = 0; i < n; i++)
a[i] = (int*) malloc(sizeof (int) * m);
for (i = 0; i < n; i++) {
... |
C | #include <stdio.h>
int main(void)
{
printf("Hello World!\n");
for (int i=0; i<100; i++)
{
if(i%2==0)
{
if(i%4==0)
{
printf("continue!!\n");
continue;
}
printf("i=%d\n", i);
}
printf("-----i=%d-\... |
C | #include <stdio.h>
#include "util.h"
#include "symbol.h"
#include "temp.h"
#include "tree.h"
#include "frame.h"
#include "printtree.h"
const int F_WORD_SIZE = 4; /* 4 byte */
static const int F_MAX_REG = 6; /* paras in regs number */
struct F_frame_ {
Temp_label name;
F_accessList formals;
int local_count;/*loca... |
C | #include "c_time_format_conversion.h"
TIME tm_create_time(void)
{
TIME tm;
memset(&tm, 0, sizeof(tm));
time_t tm_now;
time(&tm_now);
memcpy(&tm.now, localtime(&tm_now), sizeof(struct tm));
sprintf(tm.date, "%d-%d-%d", tm.now.year, tm.now.month, tm.now.day);
sprintf(tm.time, "%d:%d:%d", tm.now.hour, tm.now.minut... |
C | #include "protocol_session.h"
#include "player.h"
extern void player_dump(Player *p)
{
printf("Player [team=%d][id=%d] : (x=%d;y=%d)\n", p->team, p->id, p->x, p->y);
}
extern void player_copy(Player *p1, Player *p2) {
p1->x = p2->x;
p1->y = p2->y;
p1->state = p2->state;
p1->team = p2->team;
p1->id = p2->i... |
C | #include "euler.h"
int factorialize(int num);
int main(int argc, char **argv);
int factorialize(int num) {
int len;
int fact_sum = 0;
int* num_arr = split_number(num, &len);
for (int i = 0; i < len; ++i)
fact_sum += factorial(num_arr[i]);
free(num_arr);
return fact_sum;
}
int main(in... |
C | /*
* Write the function strend(s,t), which returns 1 if the string t
* occurs at the end of the string s, and zero otherwise.
*/
#include <stdio.h>
#include <stdlib.h>
int strend(char *, char *);
int main(void) {
char s1[15] = "absdefg";
char s2[15] = "defg";
char s3[15] = "fdas";
printf("%d\n", strend(s1,... |
C | #include "p24fj64ga002.h"
#include "initLEDS.h"
void initLEDS(){
/*Using the helper function from GitHub*/
TRISB &= 0x0FFF;
LATB |= 0xF000;
}
void turnOnLED(int led){
/*
if (led == 4){
LATBbits.LATB15 = ON;
LATBbits.LATB14 = OFF;
LATBbits.LATB13 = OFF;
... |
C | #include <stdio.h>
int main(){
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if(a+b+c>=100) printf("OK");
else{
if(a>b && c>b) printf("Korea");
if(a>c && b>c) printf("Hanyang");
if(c>a && b>a) printf("Soongsil");
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
int dlugosc(char napis[])
{
int wynik =0;
int i=0;
while(napis[i]!=0)
{
wynik++;
i++;
}
return wynik;
}
int dlugosc2(wchar_t napis[])
{
int wynik =0;
int i=0;
while(napis[i]!=0)
{
wynik++;
... |
C | #include<stdio.h>
main()
{
int i=10;
printf("Hello world %d\n",i);
}
|
C | /*
** my_strlen.c for my_strlen.c in /Users/cicofran/Piscine/C/Jour_02/cicofr_d
**
** Made by CICOFRAN David
** Login <cicofr_d@etna-alternance.net>
**
** Started on Wed Oct 23 11:16:28 2013 CICOFRAN David
** Last update Wed Oct 23 21:12:18 2013 CICOFRAN David
*/
int my_strlen(char *str)
{
int co;
for (co = 0;... |
C | #ifndef ANALOG_H
#define ANALOG_H
#define SIZE_ANALOG_BUFFER 20
#define BAT_PIN 9
//change this to 9 but not now cause the python and for testing purposes
#define BAT_STRING "7"
char analog_reading_buffer[SIZE_ANALOG_BUFFER];
//Precondition: result_buffer is a pointer to allocated space
//Postcondition: Stores the ... |
C | #pragma once
#include <stdint.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define UFBXW_MAX_DEPTH 32
#define ufbxw_arraysize(arr) (sizeof(arr)/sizeof(*(arr)))
typedef struct {
uint32_t version;
bool ascii;
char vertex_type;
char inde... |
C | #include <windows.h>
#include <stdio.h>
int main()
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
int ret;
ret = GetConsoleScreenBufferInfo(GetStdHandle( STD_OUTPUT_HANDLE ),&csbi);
if(ret)
{
printf("Console Buffer Width: %d\n", csbi.dwSize.X);
printf("Console Buffer Height: %d\n", csbi.dwSize.... |
C | #include <omp.h>
#include <stdio.h>
#define N 8
int main(int argc, char** argv)
{
int arr[32];
int i;
omp_set_num_threads(N);
#pragma omp parallel shared(arr) private(i)
{
#pragma omp for
for (i = 0; i < 32; i++)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX(a,b) (((a)>(b))?(a):(b))
typedef struct node* Node;
typedef struct node* Tree;
typedef struct node {
int value;
Node parent;
Node leftChild;
Node rightChild;
}node;
Tree createTree() {
Tree tmp = (Tree)malloc(sizeof(struct node));
tmp->value = 0;
tmp->leftChi... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int m,n;
scanf("%i", &n);
scanf("%i", &m);
printf("______\n");
for(int i=1; i<m+1; i++){
printf("%i\n", n*i);
}
}
|
C | #include <stdio.h>
int bitcount(unsigned x)
{
int counter = 0;
while(x)
{
counter++;
x &= x-1;
}
return counter;
}
main()
{
int input,i;
scanf("%d", &input);
int output = bitcount(input);
printf("result %d\n", output);
}
|
C | #include <assert.h>
#include "list.h"
int main(int argc, char **argv) {
List l = ListConstructor();
assert(l);
ListInsert(l, 99);
ListInsert(l, 13);
ListInsert(l, 666);
ListInsert(l, 777);
assert(ListSearch(l, 13) == 3);
ListDelete(l, 13);
assert(ListSearch(l, 13) == -1);
ListDelete(l, 99);... |
C | #include "method.h"
int problem_1() {
int year;
scanf("%d", &year);
// 4 鼭 : year % 4 == 0
// 100 ʴ : year % 100 != 0
//
if((year % 4 == 0) && (year % 100 != 0)) {
printf("\n");
} else {
printf("\n");
}
return 0;
} |
C | #include<stdio.h>
#include<string.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
void communicateClient(int connectionSocket){
char receive_buffer[1024];
char send_buffer[1024];
while(1){
bzero(receive_buffer,1024);
read(connectionSocket,receive_buffer,sizeof(receive_buffer));
print... |
C | #include "operations.h"
void mov_r32_imm32(Emulator* emu)
{
uint8_t reg = get_code8(emu, 0) - 0xB8;
uint32_t value = get_code32(emu, 1);
emu->registers[reg] = value;
emu->eip += 5;
}
void short_jump(Emulator* emu)
{
int8_t diff = get_sign_code8(emu, 1);
emu->eip += (diff + 2);
}
void near... |
C | /**
* Performs computation of the current command for power factor correction. This macro utilizes
* the PFC_ICMD_CLA_C structure which should be initialized using the PFC_ICMD_CLA_C_INIT macro.
*/
#ifndef PFC_ICMD_CLA_C_H_
#define PFC_ICMD_CLA_C_H_
/**
* Current command PFC structure
*/
typedef struct {
float... |
C | #include "tasks.h"
// lwIP libraries
#include "lwip/inet.h"
#include "lwip/sockets.h"
// Project libraries
#include "client.h"
#include "server.h"
#include "packet.h"
#include "motor.h"
#include "wifi.h"
#include "cmd_handler.h"
#include "repeater.h"
/**
* Accepts an incoming client connection
* @param task_id ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 200
typedef struct{
int row;
int col;
int val;
}Matrix;
Matrix matrix[N],transpose[N];
// doing transpose
void doTranspose(int pos,int cur){
transpose[cur].row=matrix[pos].col;
transpose[cur].col=matrix[pos].row;
transpose[... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
# define Tit 7 // 2^(3) = 8 iteraciones.
# define Tin 2 // 3 entradas.
void f_Vista();
float f_Aprendizaje(float [Tin]);
void f_Ejecucion(float [Tin], float);
void f_again(int *);
int main()
{
int again=0 ;
float Vw[Tin], thr = 0.0;
f_Vista();
... |
C | #include "game.h"
/**
* \file game.c to initialize, free, save and load a game
*
* \author Nicolas Sourbier
* \date 2/04/2017
*/
/*----------------------------------------------------------
* IMPORTANT : THE REAL PLAYER TEAM NUMBER IS 0
* OTHERS ARE UPDATED BY THE AI
*--------------------... |
C | /*****************************************************************//**
* \file Main.c
* \brief 3.11 -Dados 3 valores inteiros introduzidos pelo utilizador, indique qual o maior.
* \student id a20844@alunos.ipca.pt
* \author OSCAR ARAUJO
* \date 23 November 2020
*******************************... |
C | #include <stdio.h>
//Compiler version gcc 6.3.0
int main() {
char a[33], b[33]; //TestCase#0 has a string with 32 characters
int sizeA, sizeB, i, j, match;
scanf("%s\n%s", a, b);
for(sizeA = 0; sizeA < 33; sizeA++)
if(a[sizeA] == 0)
break;
for(sizeB = 0; sizeB < 33; sizeB++)
if(b[sizeB] =... |
C | #include "vm.h"
#include "interpreter.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
void usage() {
printf("u messed up the args, but there is no usage message yet \n");
}
int main(int argc, char **argv) {
if (argc < 2) return 1;
int debug = 0;
int c;
while ((c... |
C | #include "lexer/token.h"
#include <stdio.h>
#include <stdlib.h>
char* str_token_kind(token_kind kind) {
switch (kind) {
case OPEN_PAREN:
return "OPEN_PAREN";
case CLOSE_PAREN:
return "CLOSE_PAREN";
case PLUS:
return "PLUS";
case MINUS:
return "MINUS";
case MULT:
retu... |
C | /* Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. */
#include "main.h"
float ReadBatteryLevel(void)
{
float batteryLevel = 0.0f;
HAL_ADC_Start(&hadc);
// Turn on battery monitoring circuit
HAL_GPIO_WritePin(ENA_BATTERY_LVL_GPIO_Port, ENA_BATTERY_LVL_Pin, GPIO_PIN_SET... |
C | #include <stdio.h>
int main(void)
{
double x = 1.23; // 変数xの宣言・初期化
double y = 4.56; // 変数yの宣言・初期化
printf("%f\n", x); // 変数の中身のみ表示
printf("xは%f\n", x); // 任意の文字列と変数の中身を表示
printf("xは%f yは%f", x, y); // 任意の文字列と複数の変数の中身を表示
return 0;
}
|
C | #include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
int built_cd(char **argu, char **env)
{
char *htp = get_home(env);
printf("AA\n");
if (argu[1] != NULL)
if (chdir(argu[1]) == -1)
printf(strerror(errno));
else
chdir(htp);
return (0);
}
|
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
enum card { SPADE, HEART, DIAMOND, CLUB };
enum card mycard = SPADE;
printf("%d\n", mycard);
printf("%010d\n", 0xffff);
printf("%+10.4f\n", 4.6183);
double f = 56.7;
printf("%f\n", 5.0 / 9 * (f - 32)... |
C | // ϰ 7 м a, ʹṩһѡʵȼIJ˵ switch ѡʵȼ еĿͷӦ
// ******************************************************************
// Enter the number corresponding to the desired pay rate or action :
// 1) $8.75 2) $9.33/hr
// 3) $10.00 4) $11.20/hr
// 5) quit
// ************************************************************... |
C | /**
* Problem: Given a column title appear in an Excel sheet, return its corresponding column number.
* Solve: accumulation
* Tips: no
*/
int titleToNumber(char* s) {
int ans = 0;
int len = strlen(s);
int weight = 1;
int i;
for (i = len-1; i >= 0; --i) {
ans += (s[i]-'A'+1)*weight;
... |
C | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
int helper(struct TreeNode *root, bool isleft)
{
if(!root)
{
return 0;
}
if(root->left == NULL && root->right == NULL)
{
return islef... |
C | #include <stdio.h>
#include <string.h> /* ڿ ǥ Լ ϱ */
void main()
{
char data[10] = { 'a', 'b', 'c', 0, }; /* abc ڿ */
char result[16]; /* ο ڿ */
strcpy(result, data); /* data ڿ result */
strcat(result, "def"); /* result def */
printf("%s + \"def\" = %s\n", dat... |
C | #include<stdio.h>
int main(){
FILE *fp;
char c;
int flag,i;
int arr[10];
/* char s[80];
char fn[30];
printf("enter the file name: ");
scanf("%s",&fn);
fp=fopen(fn,"w");
if(fp==NULL){
puts("cannot open the file!\n");
getch();
... |
C | #include <stdio.h>
int main(){
int n;
scanf("%d", &n);
long long cnt=0, array[n][10];
array[0][0]=0;
for(int i=1;i<10;i++){
array[0][i] = 1;
}
for(int i=1;i<n;i++){
for(int j=0;j<10;j++){
if(j==0){
array[i][j] = (array[i-1][j+1]);
}
... |
C |
#include "stdio.h"
#include <stdlib.h>
#include <assert.h>
typedef int DataType;
typedef struct ComplexNode
{
struct ComplexNode* next;
struct ComplexNode* random;
DataType data;
}CN;
CN * CreateNode(int d)
{
CN *node = (CN *)malloc(sizeof(CN));
node->data = d;
node->random = node->next = NULL;
return ... |
C | #ifndef FUNCIONES_H_INCLUDED
#define FUNCIONES_H_INCLUDED
typedef struct {
char nombre[50];
int edad;
int estado;
int dni;
}EPersona;
/**
* Inicializa todo los estados en 0.
* @param lista el array se pasa como parametro.
* @return devuelve todo el array con los estados en 0.
*/
... |
C | #include "algebra.h"
/**
* [EN] This method check if an long long integer number is odd
* [PT] Esse metodo verifica se um numero long long inteiro e par
* @param input_number an long long integer number
* @return TRUE if is Odd or FALSE if is Even
*/
Boolean is_odd(long long int input_number)
{
Boolean is_odd = ... |
C | /* Suppose we number the bytes in a w-bit word from 0 (least significant) to w/8 − 1 */
/* (most significant). Write code for the following C function, which will return an */
/* unsigned value in which byte i of argument x has been replaced by byte b: */
/* unsigned replace_byte (unsigned x, int i, unsigned char b); *... |
C | #include "inverted_search.h"
void file_validation_n_file_list(Flist** f_head, char* argv[])
{
//Read file 1 by 1
int i = 1, ret_val, result;
while (argv[i] != NULL)
{
ret_val = is_file_empty(argv[i]);
if (ret_val == FILE_NOT_AVAILABLE)
{
printf("The file %s is not av... |
C | #include <stdio.h>
#include <stdlib.h>
struct personas{
char nombre[30];
int cd;
int pas;
};
void enviar()
{
int n;
struct personas lista[10];
printf("numero de personas-->");
scanf("%d",&n);
FILE *txt=fopen("config.txt","r");
//fputs("cantidad: ",txt);
fprintf(txt,"... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int t,i;
//read testcases
scanf("%d", &t);
//loop for test cases
for (i = 0; i < t; i++)
{
int a,d,n;
scanf("%d\n", &n);
scanf("%d %d", &a,&d);
int sum, l;
l = a+(n-1)*d;
prin... |
C | /*
item.h
*/
#ifndef _ITEM_H
#define _ITEM_H
#include <stdint.h>
struct _pos_struct
{
uint8_t x;
uint8_t y;
};
typedef struct _pos_struct pos_t;
struct _item_struct
{
pos_t pos;
uint8_t dir; /* movement has two parts: 1. dir is set, then 2. dir is executed */
uint8_t tile; /* current foregroun... |
C | // This is a programme to find area of circle using functions
#include <stdio.h>
float Area (int) ;
int main(){
int R ;
float A ;
printf("Enter the value of radius = ");
scanf("%d", &R ) ;
A = Area(R) ;
printf("The area of circle with radius %d is = %0.2f ", R , A);
}
float Area(int r ){
float area... |
C | /**
* this module holds all the requested routines in the mmn.
* calling helper functions from the helper_function modules to make the code more readable.
*/
#include <stdlib.h>
#include "heap.h"
/**
* fix one vertice of the heap, assuming all his sons are a max-min-heap
* param *array - the heap
* param index... |
C | /*编写一个程序,提示用户输入大写字母,使用嵌套循环以下面金字塔型的格式打印字母:
A
ABA
ABCBA
ABCDBCA
ABCDEDCBA
*/
#include<stdio.h>
int main()
{
int i,j;
for ( i=0; i<5; i++ )
{
char ch = 'A'; //这是输入'A'来得到输出,是不符合题意的;
for ( j=0; j<( 5-i-1 ); j++ )
{
printf(" ");
}
for ( j=0; j<=i; j... |
C |
#include <stdio.h>
int main()
{
int char[i];
string str="keeruma is a cute girl"
printf("enter the character");
scanf("%d",&char[i]);
string strlen="keeruma is a cute girl";
scanf("%s",&str);
return 0;
}
|
C | #include "../includes/minishell.h"
int check_inside(char *line, const char *redir)
{
char *start1;
char *start2;
char *end1;
char *end2;
start1 = ft_strchr(line, '\'');
end1 = ft_strrchr(line, '\'');
start2 = ft_strchr(line, '\"');
end2 = ft_strrchr(line, '\"');
if (start1)
{
if (redir - start1 > 0 && red... |
C | //
// MemoryManager.c
// HW2_MemoryManagement
//
// Copyright © 2017년 2학기 System Programming. All rights reserved.
//
// 이름 : 장호연
// 학번 : 2015038568
// 학과 : 컴퓨터공학과
//
#ifndef _MemoryManager_H_
#define _MemoryManager_H_
#include <stdio.h>
#include "DLinkedList.h"
Block *m_alloc(int size);
void m_free(Block bloc... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char b[20];
int i, length,c;
int flag = 0;
scanf("%s", b);
length = strlen(b);
for(i=0;i < length ;i++)
{
if((b[i]=='a'||b[i]=='e'||b[i]=='i'||b[i]=='o'||b[i]=='u')||(b[i]=='A'||b[i]=='E'||b[i]=='I'||b[i]=='O'||b[i]=='U'))
... |
C | /*Write a program last that prints the last n lines of its text input. By default n should be 5, but
your program should allow an optional argument so that
last -n
prints out the last n lines, where n is any integer. Your program should make the best use of
available storage. (Input of text could be by reading a file s... |
C | #include <stdlib.h>
#include <stdio.h>
#include "GAME_ERROR.h"
#include "heartRound.h"
#define MAGIC 4561778
#define TRICK_NUM 13
#define NUM_OF_DECKS 1
struct Round{
Player **m_players;
size_t m_numOfPlayers;
int *m_roundScoreArr;
int *m_gameScoreboard;
int m_trickCnt;
size_t m_currentRoundNu... |
C | /*
TASK:Possess
LANG: CPP
AUTHOR: KersaWC
SCHOOL: REPS
*/
#include<stdio.h>
#include<math.h>
int main()
{
double k,d,bk,s=15,x,y,xaxis,r,f,h;
scanf("%lf %lf",&k,&d);
if(k==40)
{
if((15+D)%120<60) printf("%.1lf",fmod((D+15),120);
else if(fmod((15+d),120)>60) printf("%.1lf",1... |
C | #include <stdio.h>
#include <stdlib.h>
#include "CPUmanagement.h"
void OrgranisationParPrio(int* Q,int Qsize,task* T,int newTask)
{
Qsize--;
while((Q[Qsize]<0)&&(Qsize>=0))//ignore -1 (empty cases)
Qsize--;
while((Qsize>=0)&&((T+Q[Qsize])->priority>(T+newTask)->priority))//if case below newbi have lower prio(bigge... |
C | #include<stdio.h>
#include<string.h>
#include<dirent.h>
#include<sys/stat.h>
void mv(char *src, char *dst){
FILE *in,*out;
in=fopen(src,"r");
char copy[1000];
sprintf(copy,"%s/%s",dst,src);
out=fopen(copy,"w+");
if(in==NULL){
fclose(out);
remove(src);
return;
}
else{
char str;
while((str=... |
C | /********************************************************************************************************
This code block is able to encrypt and decrypt a message using a known key
The code uses a Rotation Cipher (Ceasar) and a Substitution Cipher
The input can be both upper and lower case with the output being only in... |
C | #include "stdio.h"
int main (int argc, char** argv, char** env) {
for (int i = 0; env[i]; i++) {
printf("env[%d] = >>>%s<<<\n", i, env[i]);
}
if (!argc) {
printf("hello world\n");
return 0;
}
char hello[32];
snprintf(hello, 32, "hello %s", argv[0]);
printf("The stack ... |
C | /*
10. Write a program to open a file with read write mode, write 10 bytes,
move the file pointer by 10 bytes (use lseek) and write again 10 bytes.
a. check the return value of lseek
b. open the file with od and check the empty spaces in between the data.
*/
#include <sys/types.h>... |
C | #include <stdlib.h>
#include <stdio.h>
#include "dyn_array.h"
struct d_array {
int size;
int used;
void** element_ptrs;
};
d_array* d_array_new(unsigned int size){
d_array* array = malloc(sizeof(d_array));
array->size = size;
array->used = 0;
array->element_ptrs = malloc(array->size * size... |
C | #include <stdio.h>
#define MAX 100
int insere(int n, int v[MAX], int k, int y){
int j;
for(j=n;j>k;j--){
v[j]=v[j-1];
}
v[k]=y;
return n+1;
}
int insere_R(int n, int v[MAX], int k, int x){
if(k==n){
v[n]=x;
return n+1;
}
else{
int aux;
aux=v[k];
v[k]=x;
return insere_R (n,v,k+1,... |
C | #ifndef CELIB_FS_H
#define CELIB_FS_H
#include <time.h>
#include "../memory/memory.h"
#include "../containers/array.h"
#if defined(CELIB_LINUX)
#include <dirent.h>
#include <sys/stat.h>
#include <errno.h>
#endif
//==============================================================================
// File Interface
//=... |
C | #include "string/diff.h"
#include "string/utils.h"
#include "memory/alloc.h"
#include <string.h>
char *diff(const char *string1, const char *string2)
{
int i, j, len1, len2, size, aux;
char *ret;
len1 = strlen(string1);
len2 = strlen(string2);
if (!len1 && !len2) {
return NULL;
}
if (!len1) {
return xst... |
C | #include <stdio.h>
#include <stdlib.h>
#define maxPilha 100
#define maxNome 80
typedef struct tipoDado{
char nome[maxNome];
int idade, rg;
} tipoDado;
typedef struct tipoPilha{
tipoDado pilha[maxPilha];
int topo;
}tipoPilha;
void criaPilha(tipoPilha *p);
int pilhaCheia(tipoPilha p... |
C | #include<stdio.h>
#include<stdlib.h>
unsigned short SetFlag(short int number, unsigned char position)
{
return (number | (1 << position));
}
unsigned short ClearFlag(short int number, unsigned char position)
{
return (number & ~(1 << position));
}
unsigned char GetFlag(short int number, unsigned char position)
{
... |
C | /*
* Questions: when to use perror?
* ass2.c
*/
#include "proto.h"
/* Shell main */
int argc;
int base;
char** argv;
FILE* flog;
int main (int mainargc, char **mainargv) {
//collecting arguments, saving globally
argc = mainargc;
argv = mainargv;
base = 0;
char *prompt = getenv("P1");
if(!prompt)
prompt = ... |
C | /*
Singly linked list example Programm
@Author: Federico Baú
@Date: 02 - Jan 2021
*/
#include <stdio.h>
#include <stdlib.h>
#include "linked_list.h"
#include "linked_list.c"
void main_linked_list_Print(int idx, void *data)
{
printf("%d: %d, ", idx, (int) data);
}
int main_linked_list_Delete... |
C | #ifndef MYSTACK_H
#define MYSTACK_H
#include <stdbool.h>
#define MAX_STACK_SIZE 16
typedef struct _MyStack_ {
int top; // the top-pointer of the stack
int data[MAX_STACK_SIZE]; //the actual stack data
} MyStack;
/*
* instantiates a new stack and returns a pointer to it.
* must be free'ed using stack_delete(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sortedList.h"
int remove_nth (Sorted_list* userSortedList, value_t* userValue, Key_t* userKey,int n,int order)
{
if( n >= size(userSortedList)){
printf("FAILED,n >= size where size = %d\n",size(userSortedList));
return FAIL;
}
if(order ... |
C | #include "LIST/List.h"
#include <stdlib.h>
typedef struct ListNode {
struct ListNode *pNext;
void *pData;
} tListNode;
struct List {
tListNode *pHead;
size_t len;
List_cmpFunc cmp;
List_freeFunc free;
};
/*
* Allocate memory for a list with no nodes initially
* */
List *List_create(List_cmpFunc argCmp, List_... |
C | #include <stdio.h>
int main()
{
int ratings[3][4];
int i,j,total=0,movie;
float ave,max = 0;
for(i=0;i<=2;i++)
{
for(j=0;j<=3;j++)
{
printf("Input the Ratings for movie %d by reviewer %d: ",i+1,j+1);
scanf("%d",&ratings[i][j]);
} printf("\n");
}
for(i=0;i<=2;i++)
{
for(j=0;j<=3;j++)
{
pr... |
C | /*
* This file is part of the SmokeOS project.
* Copyright (C) 2015 <Fabien Bavent>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, ... |
C | //
// Created by Aliaksei Syrel on 10.03.17.
//
#include <stdio.h>
#include <math.h>
#include "input.h"
#define INPUT_LENGTH 16
/*
* Q: What does it do?
* A: A program computes square roots of two float number and prints results.
*
* Q: What is the problem with it? (mathematically)
* A: The first number is posi... |
C | //
// question-30.h
// algorithm
//
// Created by Kai on 2019/8/19.
// Copyright © 2019 kai. All rights reserved.
//
#ifndef question_30_h
#define question_30_h
/*
设计一个栈,有 min 函数。该栈中,调用 min, push, pop 时间复杂度都是 O(1)。
*/
#include <stdio.h>
#include "stack.h"
// 该结构内部用两个栈实现,main 栈用于存储目标数据,minValues 存储最小值。
typedef... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mergesort.h"
static int assertionCount = 0;
static int errorCount = 0;
void printArray(int arr[], int size)
{
for (int i=0; i < size; i++) printf("%d ", arr[i]);
printf("\n");
}
// Compare arrays helper
int
compareArrays(int a[], int b[], in... |
C | #ifndef NO_FOLHA_H
#define NO_FOLHA_H
#include <stdio.h>
#include "pizza.h"
typedef struct NoFolha {
// m eh o numero total de registros armazenados no noh
int m;
// ponteiro para o noh pai
int pont_pai;
// ponteiro para o proximo noh folha
int pont_prox;
// essa lista tera sempre m pizzas
TPizza **pizzas;
}... |
C | #include <string.h> /* memset */
#include "common.h"
#include "constants.h"
#include "objectMemory-objects.h"
#include "objectMemory-gc-remembered.h"
#include "objectMemory.h"
#include "objectMemory-smallIntegers.h"
// An object is represented in memory as an array of OPs/integers.
//
// The structure of an object: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.