language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <linux/module.h>
#include <linux/sched.h>
#include <linux/pid.h>
#include <linux/kthread.h>
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/printk.h>
#include <linux/jiffies.h>
#include <linux/kmod.h>
#include <linux/fs.h>
#include <linux/init.h>
MODULE_LICENSE("GPL");... |
C | #ifndef __FUNCTIONS_H__
#define __FUNCTIONS_H__
struct functions
{
bool sw1 = 0, sw2 = 0, sw3 = 0, sw4 = 0,
sw5 = 0, sw6 = 0, sw7 = 0, not1 = 0,
not2 = 0, not3 = 0, not4 = 0, and1 = 0,
and2 = 0, and3 = 0, and4 = 0, or1 = 0,
or2 = 0, or3 = 0, or4 = 0, or5 = 0,
moved = 0, moved1 = 0, moved2 = 0, moved3 = 0;
... |
C | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int sumNumbers(TreeNode *root) {
// Start typing your C/C++ solution below
// DO NOT wr... |
C | // BOA-TEST 1
// simple malloc
#include <stdlib.h>
int main() {
char *p, *q, *r;
int i = 4;
p = (char*)malloc(i);
p[4] = 'a';
q = (char*)malloc(i + 1);
q[4] = 'b';
r = (char*)malloc(i - 1);
r[4] = 'c';
return 0;
}
|
C |
//Q 3. write a program to send a message "end term practical" from parent process to child process.
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int main()
{
int fd[2],n;
char buffer[100];
pid_t p;
pipe(fd);
p=fork();
if(p>0)
{
close(fd[0]);
printf("Passing value to child\n");... |
C | #include "config.h"
#include <avr/io.h>
#include <avr/interrupt.h>
#include "spi.h"
/*Initalize SPI on PORTB
Parameters:
uint8_t master: if true, initalizes in master mode. Otherwise initalizes in slave mode
*/
void SPI_init(uint8_t master){
/*Set the GPIO input/outputs*/
if(master){
DDRB = (1<<PB2) | ... |
C | #include<stdio.h>
int main()
{
char arr[8][8];
int c=0;
int len;
scanf("%d",&len);
char temp[len];
char temp2;
gets(temp);
while(c<8)
{
gets(temp2);
arr=temp2;
}
puts(arr);
return 0;
... |
C | #include "io_multiplexer.h"
#include "caps_transmitter.h"
#include "demultiplexer.h"
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
int main()
{
int ioToCapsA[2], ioToCapsB1[2], capsB1ToCapsB2[2], capsAToDemux[2], capsB2ToDemux[2], back[2], r;
if (pipe(ioToCapsA) || pipe(ioToCapsB1) || pipe(capsB1T... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dsp_and.c :+: :+: :+: ... |
C | #include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include "helpers.h"
#include <math.h>
#include <ctype.h>
#include <cs50.h>
#include "bmp.h"
int main(int argc, char *argv[])
{
// Define allowable filters
char *filters = "bgrs";
// Get filter flag and check validity
char filter = getopt(arg... |
C | //BINARY TREE data structure
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node{
char *question; //question, this is not a string literal
struct node *no; //no
struct node *yes; //yes
}node;
//take the question string
int yes_no(char *question)
{
char ans[3];
... |
C |
/*
*
* VerdictVector.cpp contains implementation of Vector operations
*
* Copyright (C) 2003 Sandia National Laboratories <cubit@sandia.gov>
*
* This file is part of VERDICT
*
* This copy of VERDICT is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
... |
C | #include<stdio.h>
void main()
{
char a ;
printf("Cienijamais lietotaj! Ludzu ievadit vienu burtu:");
scanf("%c", &a);
printf("Cienijamais, lietotaj! Tu esi ievadijis simbolu %c\n", a);
printf("Cienijamais, lietotaj! Tu esi ievadijis simbolu, kura dec kods ir: %d\n", a);
printf("Cienijamais, lietotaj! Tu esi i... |
C | //****************** ( Animation Construction Kit 3D ) **********************
// Ray Casting Routines
// CopyRight (c) 1993 Author: Lary Myers
//***************************************************************************
#include <stdlib.h>
#include <stdio.h>
//#include <dos.h>
//#include <mem.h>
//#include <io... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
//gcc generateMatrix.c -lgomp -fopenmp -O2 -o generateMatrix
//./generateMatrix NAME X Y
int main(int argc, char* argv[]) {
if(argc < 4) {
perror("Too few agruments");
return 1;
}
char *filename = argv[1];
int m = atoi(argv[2]);
int n = atoi(argv[3])... |
C | #include <stdio.h>
#include <stdlib.h>
////////////////EXERCICIO 4
int Eprimo(int x)// verifica se primo
{
int i;
if(x == 2)
{
return 1;
}
for(i=2;i<(x/2)+2;i++)
{
if(x%i == 0)
{
return 0;
}
}
... |
C | #include "solution.h"
#include <stdio.h>
#include <stdlib.h>
void testcase1()
{
printf("testcase1\n");
int returnSize = 0;
int *indices = findSubstring("barfoofoobarthefoobarman", (char *[]){"foo", "bar", "the"}, 3, &returnSize);
fflush(stdout);
free(indices);
}
void testcase2()
{
printf("test... |
C | #include <stdio.h>
int gcd(int p, int q) { if (p == 0) return q; return gcd(q%p, p); }
int main()
{
int a, b;
scanf("%d %d", &a, &b);
int gcd_ab = gcd(a, b);
printf("%d\n", gcd_ab);
printf("%d\n", a * b / gcd_ab);
}
|
C | #include <stdio.h>
int fibonacci (int n){//função que calcula a soma de um número com o anterior recursivamente
if (n < 2){
return 1;
}
else{
return fibonacci (n-1) + fibonacci (n-2);
}
}
int main(void) {
int num;
scanf ("%d", &num);
for (int i=0; i < num;i++){
printf ("%d ", fibonacci(i)... |
C | #ifndef TEXTURE_POOL_H_
#define TEXTURE_POOL_H_
#include <SDL2/SDL.h>
#include "texture.h"
#define NUM_INITIAL_TEXTURES_IN_TEXTUREPOOL 1
typedef struct textureContainerT
{
textureT *texture; //pointer to the texture data
char *name; //name of the texture
}textureContainerT;
typedef struct te... |
C | #include <stdio.h>
#include <stdbool.h>
int main(void)
{
int SBP, gender, age, risk, stp;
do
{
printf("Systolic blood pressure: ");
scanf("%d", &SBP);
}
while(SBP <= 0);
printf("Gender (0 for Male, 1 for Female): ");
scanf("%d", &gender);
printf("Age: ");
scanf("%d", &age... |
C | #include "unity/unity_fixture.h"
#include "test_common.h"
#include "nmpps.h"
TEST_GROUP(tests_threshold_gt);
TEST_SETUP(tests_threshold_gt){};
TEST_TEAR_DOWN(tests_threshold_gt){}
/// nmppsThreshold_GT_16s
TEST(tests_threshold_gt, test_nmppsThreshold_GT_16s_null_ptr){
nmpps16s a;
TEST_ASSERT_EQUAL(nmppsStsNullPt... |
C | #include <stdlib.h>
#include <stdio.h>
#include "3-calc.h"
/**
* main - return result of desired calculation from command line options
* @argc: number of command line arguments
* @argv: array of command line arguments
*
* Return: EXIT_SUCCESS on success, 98 for wrong number of arugments,
* 99 for invalid operati... |
C | #include <stdio.h>
void read_arr(int*,int);
void print_arr(int*,int);
int ret_max(int*,int);
int main()
{
// array declaration
int arr[10], arr_size,max;
printf("Enter the number of elements \n");
scanf("%d", &arr_size);
printf("Enter the elements\n");
read_arr(arr, arr_size);
... |
C | #include<stdio.h>
#include<stdlib.h>
#include <stdbool.h>
#include <math.h>
#define MAX 50
typedef struct node
{
int label;
bool isVisited;
struct node *next;
} Vertex;
typedef struct List{
Vertex *head, *tail;
} List;
FILE *inputFile, *outputFile; // FILE handles for input and output files
List *adjList[MAX]... |
C | /*
* string.h
*
* Created on: 15 may. 2021
* Author: Yesid
*/
#ifndef DATAVALIDATION_CHARSTRING_H_
#define DATAVALIDATION_CHARSTRING_H_
#include <string.h>
#include <ctype.h>
/**
* @brief converts a character string to uppercase
*
* @param charStringEntered, character string
* @return, returns the uppe... |
C | #include <stdlib.h>
#include "sorting.h"
#include <stdio.h>
//load file function
long *Load_File(char *Filename, int *Size) {
if(Filename == NULL) {
fprintf(stdout, "\nNo filename specified.");
return NULL;
}
long *array = NULL;
int i = 0;
long int num = 0;
FILE *fptr = NULL;
//check to see if file opens
f... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct SBTNode
{
int data, size;
struct SBTNode *lchild, *rchild, *father;
} SBTNode;
#define ERROR 0
#define OK 1
void init_NIL();
SBTNode* init(int data, int size, SBTNode *father);
SBTNode * left_rotate(SBTNode * node);
SBTNode * right_rotate(SBTNode * node);
S... |
C | #include<stdio.h>
int factoril(int);
int main(){
int a,fact;
for(a=1;a<=10;a++){
fact=factoril(a);
printf("factoril of %d = %d\n",a,fact);
}
}
factoril(int n){
int result;
if (n==0)
return 1;
else
result=n*factoril(n-1);
return result;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
typedef struct no{
int codigo;
char nome[30];
struct no * next;
}no;
struct no *ptr, *A, *I, *conferir;
int main()
{
setlocale(LC_ALL, "portuguese");
system("color 6");
int i, opcao, pessoas;
ptr = NULL;
A = NULL;
... |
C | #include "holberton.h"
/**
* reverse_array - reverses an array
* @a: a pointer
* @n: the number of elements in the array
*
* Return: Nothing
*/
void reverse_array(int *a, int n)
{
int start = 0;
int holder;
while (start < n)
{
holder = a[n - 1];
a[n - 1] = a[start];
a[start] = holder;
start++;
n-... |
C | #include "upcr.h" /* MUST come first */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <umalloc.h>
int _sizes[] = { 3, 1024, 100000, 1024, 42000, 350, 100, 80,
3,3,3,3,3,3,3,3,3,3,3,3,3,50,
2049, 4097, 9, 33, 9, 33, 9, 78934, 38496 };
/* Other size test arrays which may be interesting ... |
C | void dp_putchar(char c);
void colle(int x, int y)
{
int col;
int row;
col = 1;
while (col <= y)
{
row = 1;
while (row <= x)
{
if ((col == 1) && ((row == 1) || (row == x)))
dp_putchar('A');
else if ((col == y) && ((ro... |
C | /* Program to display the address
of variables and pointers*/
#include <stdio.h>
int main()
{
float input1=1.1;
float input2=2.2;
float *ptr1;
float *ptr2;
//a)
printf("%p \n %p \n", &input1, &input2);
printf("%p \n %p \n", &ptr1, &ptr2);
//b)
ptr1=&input1;
ptr2=&input2;
//c)
printf("%f \n",*... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define BIAS 0x80
#define BUFSIZE 80
#define DATANUM 1000
int main(int argc, char **argv) {
int tm1[DATANUM] = {}, tm2, amp1[DATANUM], amp2, dif, n, m, sum1 = 0, sum2 = 0;
char buf[BUFSIZE];
FILE *fp1, *fp2;
if (argc != 3) ... |
C | #include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "mem.h"
/**
Reset the shell buffer
*/
void shell_reset_buffer() {
index_buffer = 0;
memory_set(shell_buffer, sizeof(shell_buffer), 0);
}
/**
Prints command prompt at the shell
*/
void shell_print() {
terminal_color = vga_entry_color(VGA_COLO... |
C | #include "thing.h"
int main(void) {
DATA_TYPE1 data_buff1[DATA_NUM1];
int i;
int tcp_sock_bool;
int tcp_sock_double;
fd_set fds;
struct timeval time_val;
struct sockaddr_in saddr_in;
struct in_addr in_a;
for(i = 0; i < DATA_NUM1; i++) data_buff1[i] = false;
saddr_in.sin_family = AF_INET;
sa... |
C | //----------------------------------------------------------------------------
// 프로그램명 : PHan_Lib.c
//
// 만든이 : Cho Han Cheol
//
// 날 짜 : 2006.9.18
//
// 최종 수정 : 2003.9.18
//
// MPU_Type :
//
// 파일명 : PHan_Lib.c
//-----------------------------------------------------------------... |
C | /*
Libreria de numeros aleatorios usando shuffling.
Generadores congruentes lineales usados:
- rand() implementacion gcc
- ??
*/
#include <stdlib.h>
#include <time.h>
#include <cmath>
#define K 10000
#define M1 RAND_MAX
#define M2 RAND_MAX
#include "Generador.cpp"
using namespace std;
int i ... |
C | #include<stdio.h>
#include<stdlib.h>
int * take_input(int * size)
{
printf("Enter number of elements\n");
int n;
scanf("%d",&n);
int * retarr=(int*)malloc(sizeof(int)*n);
printf("Enter elements in sorted order\n");
for(int i=0;i<n;i++)
scanf("%d",&retarr[i]);
*size... |
C | #include <stdio.h>
int main(void) {
int hours, overtime;
float pay,total, overpay, total2;
char line[100];
printf("How many hours have worked the employee?\n");
fgets(line, sizeof(line), stdin);
sscanf(line,"%d", &hours);
printf("How much you pay per hour in dollars?(just write the number)\n");
fget... |
C | #include <stdio.h>
#include <string.h>
#define D_S_MAIN 1
#define D_S 1
#if D_S
void clrscr(void);
#endif
static char daytab[2][13] = {
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{0, 31, 29, 31, 30, 31, 30, 31, 30, 30, 31, 30, 31}
};
int day_of_year (int year, int month, int day) {
int i, leap;
char (... |
C |
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
void init_arr(int arr[][2]) //arr[][2]
{
int i, j;
srand(time(NULL));
for(i = 0; i < 3; i++)
{
for(j=0;j<2;j++)
{
arr[i][j] = rand() % 5 +1;
}
}
}
void print_arr(int arr[][2])//arr[3][2]
{
int i, j;
for(i = 0; i<3;i++)
{
for( j = 0; j <... |
C | //Description: Find Surface_Area and Volume of Cylinder
//Date: 23/09/2021
//Author : Shubham Lodha
#include<stdio.h>
#define Pi 3.14
void Cyclinder(int h,int r)
{
int ans=0;
ans=(2*Pi*r*r)+(2*r*h*Pi);
printf("Surface Area of Cyclinder is %d/n",ans);
ans=Pi*r*r*h;
printf("Volume... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_base.c :+: :+: :+: ... |
C | #include<stdio.h>
void Display(int iNo)
{
int i=1;
/*while(i<=10)
{
printf("table %d*%d\n",iNo,i,iNo*i);
i++;
}*/
if(iNo<0)
{
iNo=-iNo;
}
for(i=1;i<=10;i++)
{
printf("%d\n",iNo*i);
}
}
int main()
{
int iValue=0;
printf("... |
C | #include<stdlib.h>
#include<stdio.h>
#include <time.h>
#include<pthread.h>
void * watek_klient (void * arg);
pthread_mutex_t mutex=PTHREAD_MUTEX_INITIALIZER;
int l_kf;
main(){
pthread_t *tab_klient;
int *tab_klient_id;
int l_kl, l_kr, i;
printf("\nLiczba klientow: "); scanf("%d", &l_kl);
printf("\nLiczb... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* usage.c :+: :+: :+: ... |
C | #define _CRT_SECURE_NO_WARNINGS
#define _MAX_A 1000
#define _MAX_B 4000
#include<stdio.h>
#include<malloc.h>
int main () {
int x=0, y=0;
int a, b, c;
//freopen("input.dat", "r", stdin);
while (1) {
scanf("%d %d", &a, &b);
if (a == 0 && b == 0) break;
if ((a == 0) && (b =... |
C | // Convert raw values from ADC counts to physical units
// ADC values used here are averages, max or min
// Wiring: PSP thermopile(white A- black B+)
// Wiring: PIR thermopile(black A- black C+) ; case thermistor( white D black E) ; dome thermistor (green F red G)
// Calibration constants need to be measured ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ps_set_ft.c :+: :+: :+: ... |
C | #include "dk_tool.h"
void subtractedmatrix(int n, int matrixC[n][n], int matrixA[n][n], int matrixB[n][n])
{
int i = 0, j = 0;
for(i = 0; i < n; i++)
{
for(j = 0; j < n; j++) ... |
C | /*
** ops.c for bistro in /home/chapui_s/travaux/bistro
**
** Made by chapui_s
** Login <chapui_s@epitech.net>
**
** Started on Mon Oct 28 23:05:48 2013 chapui_s
** Last update Sun Nov 10 22:54:48 2013 lowik_denel
*/
#include <stdlib.h>
#include "header.h"
#include "bistromathique.h"
int prior_ops(char op_pile, ch... |
C | #include <signal.h> /* traitement des signaux */
#include <stdio.h> /*entrées sorties */
#include <unistd.h> /*primitives de base */
int nbrecus = 0;
int nbalarm = 0;
void affsig(int signal_num) {
printf("Recpetion du dignal %d\n", signal_num);
nbrecus++;
}
void actif(int signal_num, siginfo_t *info, void... |
C | #include <stdio.h>
void rev(char *l, char *r);
int main(int argc, char *argv[]) {
char buf[] = "the world will go on forever";
char *end, *x, *y;
// Reverse the whole sentence first..
for (end = buf; *end; end++)
;
rev(buf, end - 1);
// Now swap each word within sentence...
x = buf - 1;
y = buf;
w... |
C | #include <stdio.h>
#include "Deque.h"
void main(void) {
Deque dq;
DqueueInit(&dq);
DQAddFirst(&dq, 1);
DQAddFirst(&dq, 2);
DQAddFirst(&dq, 3);
DQAddFirst(&dq, 4);
DQAddFirst(&dq, 5);
while (!DQIsEmpty(&dq))
{
printf("%d\n", DQRemoveFirst(&dq));
}
} |
C | #include <unistd.h>
#include <stdio.h>
#include "timer.h"
int main() {
struct timespec* start = timer_start();
sleep(1);
printf("Timer %.9lf\n", timer_end(start));
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
void hantei(int a,int b);
int win,lose,draw;
int main(void){
int my_hand,pc_hand;
char buf[10];
char word[10];
char yn[10];
win = lose = draw = 0;
srand((unsigned)time(NULL));
while(1){
pc_hand = ran... |
C | #include<stdio.h>
int main(){
int cases;
int W,diff,x,y;
char close;
scanf("%d",&cases);
while(cases--){
scanf("%d",&W);
close=1;
scanf("%d%d",&x,&y);
diff=x-y;
while(--W){
scanf("%d%d",&x,&y);
if(x-y!=diff) close=0;
}
if(close) puts("yes");
else puts("no");
if(cases) puts("");
}
return 0... |
C | #ifndef LIST_H
#define LIST_H
#include "thread.h"
#include <sys/queue.h>
#define FOR_EACH(E, L) for (E = L->cqh_first; E != (void*)L; E = E->pointers.cqe_next)
struct thread_s;
typedef struct list_s list_t;
typedef struct thread_s *element_t;
CIRCLEQ_HEAD(list_s, thread_s);
/*
* Alloue et initialise une liste
... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
//int main()
//{
// int a = 10;
// int* p = &a;//ָ
// return 0;
//}
//int main()
//{
// /*printf("%d\n", sizeof(char*));
// printf("%d\n", sizeof(int*));
// printf("%d\n", sizeof(short*));
// printf("%d\n", sizeof(double*));*/
// int a = 0x11223344;
// int* pa = &... |
C | #include <stdio.h>
/* Ϣ */
char* errmsg[] = {
/* 0 */ "No error",
/* 1 */ "ʱʼС",
/* 2 */ "ʱֱСڵ",
/* 3 */ "ʱСڵ",
/* 4 */ "ʱСڵ",
/* 5 */ "ʱӹٶСڵ",
/* 6 */ "ʱµٶСڵ",
/* 7 */ "ʱ̧Сڵ",
/* 8 */ "ʱȫ߶Сڵ",
/* 9 */ "ӹʱӹСڵ",
/* 10 */ "ӹʱӹС",
/* 11 */ "ӹʱֱСڵ",
/* 12 */ "ӹʱǶСڵ",
/* 13 */ "ӹʱٶСڵ",
/* 1... |
C | #include <curses.h>
#include <stdlib.h>
void fire();
int width, height;
WINDOW *wnd;
int main() {
// main initialization (FIRST LINE!)
wnd = initscr();
// do not echo text back when a key is typed
noecho();
// getch() times out after 150ms
timeout(150);
// turn off cursor display
curs_set(0);
// enable... |
C | /*Program to calculate power of a value*/
#include<stdio.h>
#include<conio.h>
main()
{
int x,y;
long pow,power();
scanf("%d%d",&x,&y);
pow=power(x,y);
printf("%d to the power %d=%d",x,y,pow);
getch();
}
long power(int x,int y)
{
int i;
long p=1;
for (i=1;i<=y;i++)
p=p*x;
return (p);
}
|
C | #include <stdio.h>
double f(double x){
double ret;
ret = 4.0 / (x*x + 1.0);
return ret;
}
|
C | #include <string.h>
#include<unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
char *ma_function(char *to_find, char *src, int *a, int *b, int *p)
{
if(to_find[*b] == '\0')
{
while(src[*p])
{
ft_putchar(src[*p]);
*p=... |
C | #include <stdio.h>
int main() {
int t, _t;
scanf("%d", &t);
for ( _t = 0; _t < t; ++_t ) {
int a, b, k;
scanf("%d %d %d", &a, &b, &k);
int c = 0;
int i, j;
for ( i = 0; i < a; ++i )
for ( j = 0; j < b; ++j )
if ( (i & j) < k )
++c;
printf("Case #%d: %d\n", _t+1, c);
}
return 0;
}
|
C | #include <pthread.h>
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <sys/socket.h>
#include <pthread.h>
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#include <... |
C | #include <stdio.h>
#include <math.h>
#define MAX_SIZE 10
#define bound pow(2.0, 127)
#define ZERO 1e-9 /* X is considered to be 0 if |X|<ZERO */
void swap(double *a, double *b)
{
double temp = *a;
*a = *b;
*b = temp;
}
int JudgeMatrix(int n,double a[][MAX_SIZE])
{
double b[MAX_SIZE][MAX_SIZE];
fo... |
C | #include<stdio.h>
#include<stdlib.h>
struct student
{
int roll;
char name[20];
int yr;
}stud[100];
int main()
{
int i,n,r,y,j=0,k;
printf("Enter number of students");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\nInformation about student %d\n",i);
printf("Enter roll number = ");
scanf("%d",&stud[i].roll)... |
C | /*
============================================================================
Name : estrutura_exe_02.c
Grupo : Eduardo Ferreira, Caroline e Edvar
Description : exerccio 02
============================================================================
Agora faa os exerccios abaixo onde cada programa... |
C | #include <stdio.h>
#include<string.h>
int printRepeat(char a,int size);
int printWithSpace(char column[],int size);
int findMaxLength(char name[][10]);
int main()
{
char name[][10]={"abvnnc","xyz","ws"};
char age[][3]={"10","9","13"};
char place[][10]={"abvnnc","xyz","ws"};
int max= findMaxLength(name);... |
C | #include<stdio.h>
int nzd(int n, int m);
int main() {
int n, m;
printf("Unesite broj n i m:\n");
scanf("%d%d", &n, &m);
printf("NZD je:%d\n", nzd(n, m));
return 0;
}
int nzd(int n, int m) {
if (n % m == 0)
return m;
else
nzd(m, n % m);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test.c :+: :+: :+: ... |
C | #include "graphics.h"
void drawMenu(ALLEGRO_FONT*title_font, ALLEGRO_FONT*font, unsigned char r, unsigned char g, unsigned char b, int choice, int width, int height) {
enum { START, RANKING, HELP, EXIT };
al_draw_text(title_font, al_map_rgb(255, 255, 255), width / 2, height / 2 - 300, ALLEGRO_ALIGN_CENTER, "SNAK... |
C | #ifndef __menubar_h__
#define __menubar_h__
#include <stdint.h>
typedef enum
{
mitEntry,
mitSeparator,
mitSubMenu, // FIXME: segment into MainMenu/SubMenu so that orientation is automagic?
} MenuItemType_t;
typedef struct MenuItem
{
const char *text;
int width;
int checked; // Only for mitE... |
C | #include <stdio.h>
#include <stdlib.h>
void bubblesort(int dizi[], int size) {
int i, j, temp;
for (i = 0; i < size; i++) {
for (j = 0; j < size - i - 1; j++) {
if (dizi[j + 1] < dizi[j]) {
temp = dizi[j + 1];
dizi[j + 1] = dizi[j];
dizi[j] = temp;
}
}
}
}
void printing(int dizi[], int size... |
C | #include "get_next_line.h"
int main()
{
char *line;
int fd;
fd = open("txt", O_RDONLY);
line = NULL;
while ((get_next_line(fd, &line)) > 0)
{
printf("linea: %s\n", line);
free(line);
line = NULL;
}
free(line);
system("leaks a.out");
line = NULL;
}
|
C | #ifndef BSTREE_H
#define BSTREE_H
#include <stdlib.h>
#include <string.h>
struct _bstree_node {
struct _bstree_node *left;
struct _bstree_node *right;
char key[0];
};
struct _bstree {
struct _bstree_node *root;
size_t size;
size_t element_size;
int (*compare)(const void*, const void*);
};
typedef str... |
C |
#include "stm32f10x.h"
#include "stm32f10x_usart.h"
#include "usart.h"
#include "misc.h"
#include "stdio.h"
#include "string.h"
/*
USARTGPIO
*/
void USART2_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* GPIOAʱӡAFIOʱӣUSAR... |
C | #include "stattest_gaus.h"
#include <math.h>
using namespace std;
void stattest_gaus::set_data(vector<double> data)
{
if (data.size() != m_nbins)
{
cout << "Error, wrong size for data vector" << endl;
return;
}
m_data = data;
}
void stattest_gaus::set_data_stat(vector<double> data_stat)
{
... |
C | /*
* GROUP NUMBER : 16
* GANDHI ATITH NIKESHKUMAR : 2017A7PS0062P
* BURHAN BOXWALLA : 2017A7PS0097P
* KESHAV SHARMA : 2017A7PS0140P
* SHRAY MATHUR : 2017A7PS1180P
* RAJ SANJAY SHAH : 2017A7PS1181P
*/
#include "lexer.h"
#include "parser.h"
#include "ast.h"
#include "symbolTable.h"
#include "assembler.h"
in... |
C | /*
* Name: Matthew Toro
* Class: CS344 Operating Systems
* Assignment: Program 4
* Due Date: 8/18/2017
* Description: Daemon that receives plain text from client, encrypts it, and sends it back
* */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <s... |
C | /*
* simple_sink.c
*
* Created on: 7 Sep 2016
* Author: Raluca Diaconu
*/
#include <endpoint.h>
#include <middleware.h>
#include <load_mw_config.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
void print_callback(MESSAGE *msg)
{
ENDPOINT *ep = msg->ep;
/* parsing the message and extracting... |
C | #define DR 0x00
#define FR 0x18
#define RXFE 0x10
#define TXFF 0x20
typedef struct uart{
char *base;
int n;
}UART;
UART uart[4];
int uart_init()
{
int i; UART *up;
for (i=0; i<4; i++){
up = &uart[i];
up->base = (char *)(0x101F1000 + i*0x1000);
up->n = i;
}
uart[3].base = (char *)(0x1000... |
C | #include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<fcntl.h>
int main(){
int fd[2];
char b[25]="Hello World",b1[25];
fd[0] = open("./file.txt",O_CREAT | O_RDWR);
fd[1] = open("./file2.txt",O_CREAT | O_RDWR);
write(fd[0],b,strlen(b));
lseek(fd[0],6,SEEK_SET);
int value = read(... |
C | #include "diff.h"
#include "abs_max.h"
#include "abs_min.h"
#include <stdlib.h>
int diff(int *A, int N){
int diff;
int max=abs_max(A, N);
int min=abs_min(A, N);
int d=max-min;
return d;
}
|
C | #include <stdio.h>
#include <string.h>
void main (void)
{
char str1[10] = "First"
char str2[10] = "Second"
char str3[20];
strcpy(str3, str1);
strcpy(str3, str2);
printf("%s + %s = %s\n", str1, str2, str3);
}
|
C | #define MAX 512
#include "rozciaganie.h"
void rozciaganie(int obraz_pgm[][MAX],int *wymx,int *wymy,int *szarosci)
{
int Lmax=1,Lmin=*szarosci;
//szukanie najwiekszego elementu
for(int i=0;i<*wymy;i++){
for(int j=0;j<*wymx;j++){
if(obraz_pgm[i][j]>=Lmax)
Lmax=obraz_pgm[i][j];
}
}
//szukanie naj... |
C | /***
-----------------------------------------------------------------------------
PG7233
-----------------------------------------------------------------------------
Package name : main
Description : Rising Force Fighters
Authors : David Altuve & Leonardo Cabrera
Email : 19-91255@usb.ve / 20-91371@us... |
C | #include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
/*Estructuras*/
//Tipos de escenario
typedef struct bajoCoste{
char* nombre;
char* zona;
}bajoCoste;
typedef struct estandar{
char* nombre;
}estandar;
typedef struct deLujo{
char* nombre;
int visitas;
}deLujo;
//Escenario
typedef... |
C | #include <stdio.h>
#include <windows.h>
void version1(DWORD pid, int process_num) {
int j;
for (j=1; j <= 10; j++)
fprintf(stderr, "[Process #%d] \t ID: %d \t Value: %d\n", process_num, pid, j);
}
void version2(DWORD pid, int process_num) {
int j;
for (j=1; j <= 10; j++) {
fprintf(stde... |
C | // File Name: switching_led
// Author: R.venkatesan
# include <reg51.h>
# include <stdio.h>
sbit led_blink =P1^0 ; // led pin connected on port1^0
sbit switch_led=P1^1; // switch connected on port 1^1
void main()
{
switch_led=1; // pullup input pin
while(1) // while loop for contiue woking on pr... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* render_projection_1.c :+: :+: :+: ... |
C | #include "stdio.h"
int main() {
/*Leia 100 valores inteiros. Apresente então o maior valor lido e a posição dentre os 100 valores lidos. */
int valor, pos, maior = 0;
for(int i = 0; i < 100; i++){
scanf("%i", &valor);
if(valor > maior) {
maior = valor;
pos = i ... |
C | #include "fonctions.h"
void afficher_entete()
{
system("clear");
printf(JAUNE);
printf("\t\t\t =======================\n");
printf("\t\t\t == Shell ==\n");
printf("\t\t\t =======================\n\n" FIN);
printf(" Entrez une commande (ou help pour afficher l'aide) : \n\n");
printf(BLEU " $ ... |
C | int fact(int a) {
if (a <= 1)
return 1;
return a * fact(a - 1);
}
int main() {
int f = fact(3);
test_assert(f == 6);
return 0;
}
|
C | /* Test Virtual P's and V's. pvTestA (consumer) and pvTestB (producer)
* exchange a message using the shared segment for synchronization
* and data transmission.
*/
#include "../../h/const.h"
#include "../../h/types.h"
#include "h/tconst.h"
#include "/usr/local/include/umps2/umps/libumps.e"
#include "print.e"
int ... |
C | #include <stdio.h> /* for print */
#include <fcntl.h> /* for open() */
#include <unistd.h> /* for pathconf() */
#include <string.h> /* for strcat() */
#include <stdlib.h> /* for malloc() */
#include <errno.h> /* for errno */
int main(int argc, char *argv[])
{
char *pathname;
pathname="/Users/zouhairkhallaf/Desk... |
C | #include <stdio.h>
const static int MAX_LEN = 64;
int is_in_array(float, float*, int);
float floatmod(float, float);
float get_sum_of_remainders(float*, int);
int main() {
float arr[MAX_LEN];
float num;
int i = 0;
while(scanf("%f", &num) != EOF) {
if(!is_in_array(num, arr, i)) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.