language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
JTSK-320112
a1_p2.c
Taiyr Begeyev
t.begeyev@jacobs-university.de
*/
#include <stdio.h>
//using ternary operation
#define LEASTSIGNIFICANTBIT(CH) ((1) & (CH) ? (1) : (0))
int main() {
unsigned char ch;
scanf("%c", &ch);
//printing decimal representation
printf("The decimal representation is: %d\n"... |
C | /*绝对值排序*//*输入n(n <= 100)个整数,按照绝对值从大到小排序后输出。*/
#include<stdio.h>
#include<math.h>
int abs(int n){
if (n<0)
{
n=-n;
}
return n;
}
int main (void){
int i,k,n,temp,j;
int c[100];
while (scanf("%d",&n)&&n!=0)
{
for ( i = 0; i < n; i++)
{
printf("c[%d]",i); scanf("... |
C | #ifndef _STACK_H_
#define _STACK_H_
#include <stdbool.h>
#include <stdio.h>
#include "typedef.h"
#include "errorcode.h"
#define STACK_INIT_SIZE 100
typedef double ElemType;
typedef struct {
ElemType *base;
ElemType *top;
int stackSize;
} sqStack;
uint32 initStack(sqStack *s);
uint32 push(sqStack *s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
typedef struct Node {
int data;
int hd;
struct Node *left;
struct Node *right;
int isThreaded;
} *nodePointer;
nodePointer newNode(int data) {
nodePointer node = malloc(sizeof(struct Node));
node->data = data;
node->hd = 0;
... |
C | /*
** image/2019-04-12-16-10-43.png
*/
#include <stdio.h>
const char ESC = '\e';
const int distance = 'Z' - 'z';
char upper(char in)
{
if (in <= 'Z' && in >= 'A')
return in - distance;
return in;
}
int main() {
printf("请输入字符串:");
char ch;
while ((ch = getchar()) && (ch != ESC))
{
... |
C |
#include <ioCC2540.h>
#include "cma3000d.h"
//***********************************************************************************
// Defines
// Accelerometer connected at (rev0.6/rev1.0):
// P0_6 = DATA_READY/-
// P1_2 = -/CS
// P1_3 = SCK
// P1_4 = MISO
// P1_5 = MOSI
// P1_7 = CS/DATA_READY
#define SCK ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <pthread.h>
#include "marching_squares_parallel.h"
void msquare_1bit(uint8_t* input, size_t in_width, size_t in_height, uint8_t threshold, uint8_t* new_image, size_t start_index, size_t end_index) {
if (input == NULL || threshold < 0 || new_image =... |
C | #include "ush.h"
static int count_slash(char *c, int i, int n, int k) {
if (c[i] == '\\' && c[i + 1] == '\\') {
for (k = i; c[k] == '\\'; k++);
if ((k - i) % 2 == 0) {
if (c[i + 2] == '\\') {
for (int j = 0; j < (k - i) / 4; j++)
n++;
... |
C | #include "syscall.h"
int main(int argc, char *agrv[]) {
int pid = exec("exitCode100Test.coff", 0, 0);
int status;
int ret = join(pid, &status);
printf("return value = %d, should be 1\n", ret);
printf("status = %d, shoule be 100\n", status);
pid = exec("unhandledException.coff", 0, 0);
ret... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
void err_info(const char* err_msg);
int main(int argc, const char* argv[]) {
if (argc != 3)
err_info("Wrong number of arguments.\n");
char * from = argv[1];
char * to = argv[2];
if (strlen(from) != strlen(to))
err_info(... |
C | void foo(int a, int b)
{
int x, y, z, q;
y = a + b;
q = a*b;
y+=5;
x = y*y;
z = x;
b = z+2;
}
|
C | /*
* huge-alloc.hpp
*
* Inefficient allocator that allows allocating memory regions backed by THP pages.
*/
#ifndef HUGE_ALLOC_HPP_
#define HUGE_ALLOC_HPP_
#include <stddef.h>
#include <stdbool.h>
// 1152921504606846976 bytes should be enough for everyone
#define MAX_HUGE_ALLOC (1ULL << 60)
#ifdef __cplusplus
e... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define BUFFER_SIZE 64
/**
* Função para a geração de vetores de tamanho arbitrário
*/
int *gera(int tamanho)
{
int *retorno = malloc(tamanho * sizeof(int)); // aloca memória para o vetor
for (int i = 0; i < tamanho; ++i) { // gera um número... |
C | #include<stdio.h>
int main(){
double d;
d=0.123456789123456789123456789123456789;
printf("%.100lf\n",d);
return 0;
} |
C | #pragma once
#define DX 20
#define DY 20
float f_charts_1(float x) {
return cos(x) / sqrt(powf(x, 2) + 1);
}
float f_charts_2(float x) {
return powf(x, 2) / (exp(x) - 1);
}
float f_charts_3(float x) {
return x*exp(-x);
}
void mashtab(float xn, float xk, float *mx, float *my, float *miny, float *maxy, float(*fun... |
C | # include "solveur.h"
int has_variable(struct s_tree *tree)
{
if (tree == NULL)
return 0;
if (tree->type == VARIABLE)
return 1;
return has_variable(tree->left) || has_variable(tree->right);
}
float solveur(struct s_tree *tree, float res, int egal)
{
struct s_list *list_l = init_list();
struct s_list *... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct node {
int data;
struct node * next;
} node;
const int BUFF = 256;
node * llbuild();
node * addnode(node *, int);
node * traverse(node *, int);
int length(node *);
int search(node *, int);
int main() {
node * head = llbuild();
//frequenc... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /* Programa en C para calcular elementos de estadistica
*basica.
*/
#include <stdio.h>
#include <stdlib.h> /* Generador de numeros aleatorios for random number generator */
#include <math.h>
#include <time.h> /* inicializando el generador de numeros aleatorios */
#define N_Muestras 100
/* funcion prototipo */
v... |
C | #include <stdio.h>
#include "utils.h"
void write_file(FILE *fptr, char *data, long pos, size_t size) {
fseek(fptr, pos, SEEK_SET);
fwrite(data, size, 1, fptr);
}
char *p64(int64_t n) {
static char s[8];
for (size_t i=0; i<8; ++i) {
s[i] = n&0xff;
n>>=8;
}
return s;
}
char *p32... |
C | /*
Submit a solution for ht02-2-c/texts/longest-word-utf-8-1
Full score: 100
Run penalty: 10
Time limit: 2 s
Real time limit: 5 s
Memory limit: 64M
Open date: 2017/10/12 14:00:00
Date penalty: 2017/12/31 0-50/14d
Problem ht02-2: c/texts/longest-word-utf-8-1
На стандартный поток ввода подается текст в кодир... |
C | /*********************************************************
Name : Abhishek
Roll No : B15103
IC 250 Lab Assignment 04 - Question 3 - Main file
Date : 08/09/2016
*********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "queue_header.h"
int main()
{
int no,ch,e;
printf(... |
C | /**
* @author yangyanzhan
* @email yangyanzhan@gmail.com
* @homepage http://www.yangyanzhan.com
* @github_project https://github.com/yangyanzhan/CodeMonk
* @online_judge timus
* @problem_id 1493
* @problem_address http://acm.timus.ru/problem.aspx?space=1&num=1493
**/
#include <time.h>
#include <math.h>
#includ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int nbValeur;
int tabValeur[255];
int loop;
int plusGrosseValeur;
printf("Combien de valeur avez-vous à comparer ?\n");
scanf("%d", &nbValeur);
printf("\n");
for(loop = 1; nbValeur >= loop; loop++){
printf("%d valeur: ", loop... |
C | #include<stdio.h>
void main()
{
int i=0,num,num1,j=0;
printf("Enter the last no to be printed :- ");
scanf("%d",&num);
num1=num;
int linecount=0;
while (num>0)
{
if(linecount>9)
{
printf("\n");
linecount=1;
}
else linecount++;
... |
C | /*project to display a string on a 16*2 lcd display
* File: singlecharecter_display.c
* Author: tashi
*
* Created on 3 August, 2017, 7:54 PM
*/
// PIC16F876A Configuration Bit Settings
// 'C' source line config statements
// CONFIG
#pragma config FOSC = XT // Oscillator Selection bits (XT oscillator)
... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>
//ģʵֿ⺯strlen
//int my_strlen(const char *str)
//{
// int count = 0;
// assert(NULL != str);
// while (*str)
// {
// count++;
// str++;
// }
// return count;
//}
//int main()
//{
// char arr[] = "hello world";
// int ret = my_strlen(arr);
// pri... |
C | /*
============================================================================
Name : reint.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#i... |
C | #include <unistd.h>
#include <sys/wait.h>
#include <stdio.h>
int main() {
// Cria-se um novo processo.
int pid = fork();
// Quando o resultado do fork é igual a 0 é o FILHO.
// Quando o resultado do fork é diferente de 0 é o PAI.
if(pid == 0) printf("Filho -> Meu PID: %d / PID meu pai: %d\n",getp... |
C | /*
All constants should be difined in the headerfile
*/
#define COL 6
#define ROW 5
typedef struct Cords{
int row;
int col;
bool tf;
}Cords;
/*
This is an struct for positioning X;Y,Z
good for using an array with structs in stead of 2d array you can use
single dimention array.
defining a struct is done in the heade... |
C | /**
* @file PORT.h
* @brief PORT Module Header File for this program
* @author Nour
* @date 27/7/2020
* @version 1.0
*/
//--------------------- Header Guard -------------------------------
#ifndef PORT_H
#define PORT_H
// ------------------ File Inclusions -------------------------------... |
C | /* -------------------------------------------------------------------- */
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <log4c.h>
#include <event.h>
#include <pthread.h>
#include "echo-log.h"
/* -------------------------------------------------------------------- */
log4c_category_t *logca... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "mnist.h"
float RandomFloat(float Min, float Max)
{
return ((float)rand()/(float)RAND_MAX) * (Max - Min) + Min;
}
void kaiming_uniform(float**** kernel, int in_channels, int out_channels, int kernel_size){
//fan-in fan-out calculation based on... |
C | // Current state of the programme solves all puzzles. The trial and error approach does not work in compliance with all the sudokus possible. There needs to be recurence involved.
// Also the code needs a lot of cleaning.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#def... |
C | #include <stdio.h>
#include <stdlib.h>
/* Reglas Funciones
1.Lo que todos los lenguajes conmparten para definir una funcionalidad.Prototipo o Firma(Firma porque es ùnica, compuesta por el tipo de dato que retorna)
void saludar(void);
2.En la parte 2 esta el main
main
invocar funcion
3.Definir la funcion... |
C | #include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
int main(int argc, string argv[])
{
string k = argv[1];
if (argc != 2)
{
printf("you can use only two command line arguments\n");
return 1;
}
else
{
for (int i = 0, m = strlen(argv[1]); i < m; i+... |
C | /*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
// For SkPMFloat(SkPMColor), we widen our 8 bit components (fix8) to 8-bit components in 32 bits
// (fix8_32), then convert those to floats.
// round() does the opposite, wor... |
C | /*
* Copyright (C) copy from linux kernel.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT A... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
struct memory {
char *process;
int space;
struct memory * next;
};
struct memory *head;
void initialize(int space) {
head = (struct memory *) malloc (sizeof(struct memory));
head -> process = (char *) malloc (sizeof(c... |
C | /* 2. Write a program to find
the largest of 3 numbers using nested if */
#include <stdio.h>
int main() {
int num1, num2, num3;
printf("Enter 3 numbers:\n");
scanf("%d %d %d", &num1, &num2, &num3);
if (num1>num2) {
if (num1>num3) {
printf("%d is largest", num1);
} else {
... |
C | /****************************************************************
* Scheduler *
* Related files: scheduler.c, scheduler_test.c scheduler.h *
* task.c, task.h uid.h, uid.c *
* #Version: V 1.3 ... |
C | /*
* Copyright 2017 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "drv_array_helpers.h"
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "util.h"
struct drv_ar... |
C | #include <stdio.h>
int main() {
int t;
scanf("%d", &t);
int arr[t];
int even=0,odd=0;
for(int i=0;i<t;i++)
{
scanf("%d", &arr[i]);
if((arr[i]%2)==0)
even++;
else
odd++;
}
if(even>odd)
printf("READY FOR BATTLE");
else
printf("NOT READY");
return 0;
}
|
C | /*
*calculateFunctions.c
*/
#include "calculateFunctions.h"
double frekans =0;
double dielektrikSabiti =0;
double yamaYukseklik =0;
double yamaGenisligi(void) {
const double isikHizi = 3 * pow(10, 8);
const double giga = pow(10, 9);
return isikHizi / (2 * frekans*giga)*pow((dielektrikSabiti + 1) / 2, -0.5)*pow(10,... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <math.h>
#include <assert.h>
#include "disk_driver.h"
#include "simplefs.h"
#define TRUE 1
#define FALSE 0
#define FILE_DIM 2048 //sono 2048 * 512 B = 1024 KB = 1 MB
// initializes a file system on an already made disk
// r... |
C | #ifndef __DIRENT_H_
#define __DIRENT_H_
/*---------------------------------------------------------------------------*/
/* dirent.h - POSIX directory handling definitions */
#ifdef WIN32
#include <wtypes.h>
#include <tchar.h>
#include <direct.h>
#ifndef getcwd
#define getcwd(s,l) _getcwd(s,l)
#endif
#endif /* of i... |
C | /*
Enter the number: 10
Factorial of 10 is (1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10) = 3628800
*/
#include<stdio.h>
int main()
{
int n,i,fact;
printf("Enter the number: ");
scanf("%d",&n);
printf("Factorial of %d is (1",n);
for(i=2,fact=1;i<=n;i++)
{
printf(" * %d",i);
fact = fact*i;
}
printf(") ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
// #include<sys/wait.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
char filename[30];
int pipe_count = 0;
int cmd_count = 0;
char cmd[10][50];
int fd0[2],fd2[2];
void Split(char *ch){
strcpy(filename,"");
int i = 0,j =... |
C | #include <stdio.h>
int main(){
float fahr, celcius;
int low, high, step;
low = 0;
high = 300;
step = 20;
printf("%3s\t%6s\n", "F", "C");
printf("==============\n");
fahr = low;
while (fahr <= high){
celcius = 5.0 / 9.0 * (fahr - 32);
printf("%3... |
C | /* This program opens a dbm database and inserts the key/value pair provided as
* arguments. It then dumps the entire database.
*/
#include <stdio.h>
#include <stdlib.h>
#include <ndbm.h>
#include <fcntl.h>
#include <string.h>
void dump(DBM *db){
datum key;
datum val;
char * key_str;
char * val_str;... |
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int diem;
printf("Nhap vao so diem cua hoc sinh : ");
scanf("%d", &diem);
if(diem>=75)
printf("Hoc sinh do duoc xep loai A ");
else if (d... |
C | /*
* UART_module.c
*
* Created on: 30/08/2015
* Author: Ryan Taylor
*/
#include "UART_module.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_uart.h"
#include "driverlib/uart.h"
/* U... |
C | #include<stdio.h>
int main()
{
int T;
scanf("%d",&T);
int i;
for (i = 0; i < T; i++)
{
int number1, number2;
scanf("%d",&number1);
scanf("%d",&number2);
int sum;
sum = number1 + number2;
printf("%d\n",sum);
}
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int arr1[] = {78, 15, 33, 42, 17, 10, 55, 1, 4, 3};
int i, j = 0, k = 0, n = 10;
int arr2[n], arr3[n];
for (i = 0; i < n; i++)
{
printf("Array[%d] = %d\n", i, arr1[i]);
}
for (i = 0; i < n; i++)
{
if (arr1[i] % 2 == 0... |
C | /*
* os_file.c
*
* Created on: Mar 16, 2016
* Author: duping
*/
// TODO : more OS
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include "../common/common.h"
#include "os_file.h"
/*
* return < 0 means error occurred, > 0 means fd
*/
int createFile(const char *path_p, c... |
C | //работает с файлами и ручным вводом через stdin.
//мануальчик и информативные сообщения об ошибках и кривом вводе в комплекте.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MANUAL_INPUT (file==NULL)
void error(int);
void man();
void print(int);
int read_line(int, char *);
void main... |
C | /* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "esp_err.h"
typedef struct {
void *buffer[2]; /*!< Pointer to the ping-pong buffer structure >*/
uint8_t writeIndex; ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int size;
typedef struct{
char name[200];
char address[200];
}person;
person *contacts;
void add(char *name, char *address){
++size;
contacts = realloc(contacts, size*sizeof(person));
strcpy(contacts[size - 1].name, name)... |
C | #include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
int main(void)
{
string text = get_string("Text:");
// get length of text
int len = strlen(text);
// initiatlize counters forletter, word, and sentence
int letter_counter = 0;
int word_counter = 1;
... |
C | //
// HMBasicFunc.c
// SearchEngine
//
// Created by Shen guo on 5/25/18.
// Copyright © 2018 Shen guo. All rights reserved.
//
#include "HMBasicFunc.h"
int hashFunc(char * key) {
int keyIndex = 0;
for(int i = 0; i < strlen(key); i++) {
keyIndex += *(key + i);
}
keyIndex = keyIndex % SIZE;... |
C | #include "header.h"
//Procedure that creates a doubly linked list
node *createList(node *headNode, char argv[])
{
FILE *fi; //fi - input file
fi = fopen(argv, "r");
if(fi == NULL) //If file doesnt exist returns NULL
{
printf("\nError! Could not open data file\n");
exit(1);
}
i... |
C | #ifndef EVENTS_H_
#define EVENTS_H_
#include "ComponentDefs.h"
enum EventID
{
EVENT_NEW_ENTITY,
EVENT_REMOVE_ENTITY,
EVENT_NEW_COMPONENT,
EVENT_REMOVE_COMPONENT,
EVENT_COUNT
};
struct Event
{
// Data structures for events
// EVENT_NEW_ENTITY
struct NewEntityEv
{
EntityI... |
C | /*
* (C) Iain Fraser - GPLv3
*/
#include <stdbool.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "frame.h"
#include "lstate.h"
#include "func.h"
struct UpVal* find_stackupval( lua_State* ls, struct TValue* stackbase, int idx ){
struct list_head *seek;
struct UpVal* uv;
... |
C |
#include <common.h>
sbit beep = P2^3;
//Timer0-ʼ20ms
/*********************************************************************
* : Timer0Init
* : ʱ0ʼ
* б :
* :
*********************************************************************/
void Timer0Init(void)
{
TMOD &= 0xf0; // T0ΪʱģʽTR0ƴ
TMOD ... |
C | /*
** init.c for init in /home/onillo_l/rendu/PSU/PSU_2015_42sh/src
**
** Made by Lucas
** Login <onillo_l@epitech.net>
**
** Started on Mon May 23 15:28:46 2016 Lucas
** Last update Sun Jun 5 20:53:21 2016 Lucas
*/
#include "shell.h"
int init_separator(t_shell *shell)
{
if (((shell->sepa_array[0] = my_strdup(... |
C | /**
* Example 10: Trapping overflow (FE_OVERFLOW)
*/
// Needed to enable the use of feenableexcept
#define _GNU_SOURCE
#include <fenv.h>
#include <math.h>
#include <stdio.h>
int main(void)
{
// Disable all exceptions to begin with
feenableexcept(0);
float big1 = 3.4e+38;
float big2 = 1.0e+36;
printf("big... |
C | #include <stdio.h>
#include <stdlib.h>
#include "../dll.h"
int main(int argc,char **argv){
// Vetor 1
int vec1[3] = {1, 2, 3};
// Vetor 2
int vec2[3] = {3, 2, 1};
// Vetor que guarda a resposta da função
int r[3];
// Achando o Rn (dimensão) do vetor
int rn = sizeof(vec1) / sizeof(int);
... |
C | /* Exercise 4-4. Add commands to print the top element of the stack
* without popping, to duplicate it, and to swap the top two
* elements. Add a command to clear the stack. */
/* General idea:
The commands for printing, duplicating, swapping and clearing are
best implemented by using separate functions for e... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
// Function to allocate memory to blocks as per Best fit
// algorithm
void bestFit(int blockSize[], int m, int processSize[], int n)
{
// Stores block id of the block allocated to a
// process
int allocation[n];
//... |
C | #include <stdio.h>
#include <malloc.h>
#include <assert.h>
#include <stdbool.h>
typedef struct {
int* queval;
int front, rear;
int maxsize, quesize;
} MyCircularDeque;
/** Initialize your data structure here. Set the size of the deque to be k. */
MyCircularDeque* myCircularDequeCreate(int k) {
MyCirc... |
C | #include "jobs.h"
#include "platform.h"
#include <stdio.h>
#include <stdlib.h>
JobManager *jobManager;
static Job extractJob(JobManager *jm);
static void jobThreadProc(void* data)
{
JobManager *jm = (JobManager*)data;
while (1)
{
Job job = extractJob(jm);
if (!job.jobProc) // Heap was empty
{
sleepMs(1)... |
C | #include <stdio.h>
#include<stdlib.h>
#include<ctype.h>
int main()
{
FILE *fp;
char file[20];
char ch;
printf("please input filename:");
scanf("%s",file);
if((fp=fopen(file,"wt"))==NULL)
{
printf("fpfile open error!");
exit(-1);
}
... |
C | #include <stdio.h>
#include <stdlib.h>
/* bubblesort1: sort integer array a[length] ; standard bubblesort */
/* sorts in increasing order */
void bubblesort1(int *a, int length)
{ int i, temp, finished =0;
while(!finished)
{ finished =1;
for( i = 0; i< length-1; i++)
{ if(a[i] > a[i+1])
... |
C | //similar to import; bring in functionality in
// stdio (standard IO)
#include <stdio.h>
#include "functions.h"
/* placed in functions.h
// function prototypes
int is_prime(int n);
*/
int main(int argc, char* argv[])
{
for (int i=0; i<10; i++)
{
//printf("Hello world\n");
printf("%d is prime? %d\n", i, is_prime(... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define SIZE 128
int main()
{
close(1);
int fd = open("log.txt", O_WRONLY | O_CREAT, 0644);
if(fd < 0)
{
perror("open error\n");
return 1;
}
printf("hello world..... %d\n", f... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strtrim.c :+: :+: :+: ... |
C | int main()
{
int reverse(int num);
int num1[7],num2[7];
for(int i=1;i<=6;i++)
{
cin>>num1[i];
num2[i]=reverse(num1[i]);
}
return 0;
}
int reverse(int num)
{
int i=0,p=0;
if(num>0)
{
while(num!=0)
{
i=num%10;
num=num/10;
if(i!=0)
... |
C | #include <uvsqgraphics.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "mes_types.h"
#include "lire_ecrire.h"
#include "afficher.h"
#include "fonctions_liste.h"
#include "jouer.h"
#include "creer.h"
int est_entier(char* s) // Vérifie que la chaîne de caractère s est un ent... |
C | /* ***************************************************************************
* Cette bibliothèque de fonction est distribué librement par l'iTeam !
*
* Son but est de fournir un moyen simple pour compiler les codes enseignés
* à l'ECE (qui ne marche correctement que sous Windows).
* Nous vous invitons à l'uti... |
C | /** ***************************************************************************
* Title : buffer.c
* Description : VBIT packet buffering
* Initialise and manage circular buffers:
* Initialise buffer
* Add packet to buffer
* Pop packet from buffer
* Buffer tests: full, empty
* It also detects and rewrite... |
C | /*
Name: Paul Talaga
Date: March 29, 2018
Desc: One dimensional Conway's game of life demo.
*/
#include <stdio.h>
#define SIZE 80
int main(){
int board[SIZE] = {};
int board_temp[SIZE] = {};
/*board[10] = 1;
board[11] = 1;
board[14] = 1;
*/
int i = 0;
for(i = 0; i < SIZE; i++){
board[i] = rand() % 10 ==... |
C | #include <stdio.h>
#define MAX 10
int main()
{
int m,n;
int i,j;
int max=0;
int min=0;
int k=1;
int index=0;
int matrica[MAX][MAX];
scanf("%d %d",&m,&n);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&matrica[i][j]);
}
}
for(i=0;i<m;i++)
{
max=0;
for(j=0;j<n;i++)
{
if(matrica[j... |
C | ////////////////////////////////////////////////////////////////////////////////
// Main File: division.c
// This File: division.c
// Other Files: sendsig.c
// intdate.c
// Semester: CS 354 Spring 2018
//
// Author: William Pechous
// Email: wpechous@wisc.edu
// CS ... |
C | #include "MotorManager.h"
/*******************************************************************************
*˵:18
*******************************************************************************/
code uint8_t motor1Table[]={0x05,0x01,0x09,0x08,0x0A,0x02,0x06,0x04};
//code uint8_t motor1Table[]={0x04,0x06,0x02,0x0A,0x... |
C | //Program to compute tan(x) for given x using recursion
//Faheem Hassan Zunjani
//Wrong output as of now
#include<stdio.h>
float tan_calc(float x){
if((x>0.0)&&(x<0.001)){
return x;
}
else{
return ((2*tan_calc(x/2))/(1-(tan_calc(x/2)*tan_calc(x/2))));
}
}
void main(){
float thet;
printf(... |
C | //
// main.c
// FirstLabInC
//
// Created by Cory DeMar on 1/30/19.
// Copyright © 2019 Cory DeMar. All rights reserved.
//
#include <stdio.h>
int main() {
FILE *fp;
//fopen() function is used to open a file named example.txt in read mode
fp= fopen ("helloWorld.txt", "w");
fprintf(fp, "Hello ... |
C | #include <stdio.h>
#include <string.h>
#include "lib.h"
int main() {
struct myauthor author1;
struct mybook book1;
struct word temp_fn;
struct word temp_ln;
struct word temp_title;
struct word temp_topic;
strcpy(temp_fn.word, "Alvaro");
strcpy(temp_ln.word, "Miranda");
author1 ... |
C | /* 函数/类型 头文件 说明
* wait() sys/wait.h 等待子进程结束或者收到指定信号
* waitpid() sys/wait.h 指定pid等待子进程
* */
#include<stdio.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<unistd.h>
int main(int argc, char* argv[])
{
pid_t pid, prt;
char *FuncType = argv[1];
if (argc != 2 || (*FuncType != '1' && *FuncType != '2'))
... |
C |
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define ROWS 20
#define COLUMNS 30
int main(int argc, char *argv[])
{
char input_table[ROWS][COLUMNS];
/*addometing*/
char name[10];
int age;
float rate;
int current_row = 0;
printf("Enter name age and... |
C | #include <stdio.h>
#include <stdlib.h>
#include "tree.h"
int main()
{
int n;
//printf("Hello world!\n");
// printTree();
//int e=7;
TreeType t;
CreateTree(&t);
EntryType item;
printf("Enter number of nodes you want to enter\n");
scanf("%i",&n);
for(int i=0;i<n;i++)
{
p... |
C | /*!
* \addtogroup UpnpString
*
* Due to its heavy use, this class is coded for efficiency, not for beauty.
* Do not use this as example to other classes. Please take a look at any
* other one.
*
* \todo Always alloc a minimum size like 64 bytes or so and when shrinking
* do not perform a new memory allocation.
... |
C | //
// Created by yrohanizadegan on 27/11/17.
//
#include <stdlib.h>
#include <stdio.h>
#include "CeBiSi.h"
/* This function uses the linear congruential generator and the Lagged-Fibonacci
* generator (LFG) algorithms to produce random numbers (U(0,1)) in the unit
* interval [0,1] where the period of the prng is det... |
C | #include <avr/io.h>
#include <util/twi.h>
#include "i2c.h"
#ifndef __AVR_ATmega328P__
#include <avr/iom328p.h>
#endif
void init_i2c_master ()
{
TWBR = 0x80; //Устанавливаем скорость
TWCR = 0x0;
return;
}
uint8_t start_i2c (uint8_t addr, uint8_t flag)
{
TWCR = 0; //Сброс контрольного регистра
TWCR = (1<<TW... |
C | /*
Write a program that converts upper case to lower or lower case to upper,
depending on the name it is invoked with, as found in argv[0].
*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main(int argc, char *argv[])
{
int (*case_changer)(int);
int c;
if (argv[1]!=NULL && strcmp(argv[... |
C | /*
* OpenMP C API Test Suite
* Example A.16 from OpenMP C/C++ API sepecification
*/
#include <stdio.h>
#define N 1024
omp_lock_t lck;
int x[N];
int y[N];
void
work (id)
int id;
{
static int xnum = 0;
#pragma omp flush
x[xnum++] = id;
#pragma omp flush
}
void
work2 (id)
int id;
{
static int ... |
C | /*
* useuarray2b.c
*
* This program illustrates the use of the uarray2b interface.
*
* Although it will catch some errors in some uarray2b implementations
* it is NOT a thorough test program.
*
* NOTE: this program is commented sparsely, as figuring out
* ... |
C | #include "../include/apidisk.h"
#include "../include/t2fs.h"
#include "../include/openlib.h"
#include "../include/filelib.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
static struct opened_entries2 opened_files[0x10] = {0};
static struct opened_entries2 opened_dirs[0x10] = {0};
void printEntry(OPENED_... |
C | //
// Created by 鍋島雅貴 on 2016/06/04.
//
#include "byte_array.h"
#include <string.h>
otf_result_t byte_array_source_read(void *self, void *buf, uint32_t size)
{
byte_array_source_t * const b = (byte_array_source_t *)self;
const uint32_t readable_size = b->data_size - b->pos;
if(readable_size < size) {
... |
C | #ifndef REPEAT_WALKER_H_
#define REPEAT_WALKER_H_
#include "graph_walker.h"
#include "db_node.h"
typedef struct
{
uint64_t *const visited, *const bloom;
const size_t bloom_nbits, mem_bytes;
const uint32_t mask;
size_t nbloom_entries;
} RepeatWalker;
// GraphWalker wlk is proposing node and orient as next mov... |
C | //program on analysing *** sigaction ***
#include"header.h"
void my_isr(int n)
{
printf("in isr......n=%d\n",n);
}
int main()
{
struct sigaction v;
printf("helloo....pid=%d\n",getpid());
v.sa_handler=my_isr;
sigemptyset(&v.sa_mask);
v.sa_flags=0;
sigaction(SIGINT,&v,0);
printf("haiiii....\n");
while(1);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.